DESERT 3.5.1
Loading...
Searching...
No Matches
uwUFetch_NODE.h
Go to the documentation of this file.
1//
2// Copyright (c) 2017 Regents of the SIGNET lab, University of Padova.
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions
7// are met:
8// 1. Redistributions of source code must retain the above copyright
9// notice, this list of conditions and the following disclaimer.
10// 2. Redistributions in binary form must reproduce the above copyright
11// notice, this list of conditions and the following disclaimer in the
12// documentation and/or other materials provided with the distribution.
13// 3. Neither the name of the University of Padova (SIGNET lab) nor the
14// names of its contributors may be used to endorse or promote products
15// derived from this software without specific prior written permission.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
21// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28//
29
38#ifndef UWUFETCH_NODE_H_
39#define UWUFETCH_NODE_H_
40
41#include <mmac.h>
42#include <stdio.h>
43#include <time.h>
44#include <iostream>
45#include <clmessage.h>
46#include <mphy.h>
47#include <string>
48#include <fstream>
49#include <ostream>
50#include <cassert>
51#include <queue>
52#include <map>
53//#include "uwmphy_modem_cmn_hdr.h"
54
55#define UWFETCH_NODE_DROP_REASON_UNKNOWN_TYPE \
56 "DUT"
57#define UWFETCH_NODE_DROP_REASON_WRONG_RECEIVER \
58 "DWR"
59#define UWFETCH_NODE_DROP_REASON_CBEACON_AND_DATA_ALREADY_TX \
60 "DCDAT"
62#define UWFETCH_NODE_DROP_REASON_ERROR \
63 "DRE"
64#define UWUFETCH_NODE_DROP_REASON_BUFFER_FULL \
65 "DBF"
66#define UWUFETCH_NODE_DROP_REASON_NOT_ENABLE \
67 "DNE"
69#define UWUFETCH_NODE_DROP_REASON_NOT_MY_TURN \
70 "DNMT"
71#define UWUFETCH_NODE_DROP_CAN_NOT_RX_THIS_PCK \
72 "CNRP"
74extern packet_t
76extern packet_t PT_RTS_UFETCH;
77extern packet_t PT_CTS_UFETCH;
78extern packet_t PT_BEACON_UFETCH;
79extern packet_t PT_PROBE_UFETCH;
80extern packet_t PT_POLL_UFETCH;
81extern packet_t
88typedef struct probbed_node {
89 uint id_node_; // Id of the NODE
90 int n_pcks_NODE_want_tx_; // Number of packets that the NODE want to
91 // transmit at the HN
92 int mac_address_; // Mac Address of the NODE
93 double backoff_time_; // Back-off time chosen by the NODE before
94 // transmitting the PROBE
95
99 inline uint &
101 {
102 return (id_node_);
103 }
104
108 inline int &
110 {
112 }
113
117 inline double &
119 {
120 return backoff_time_;
121 }
122
126 inline int &
128 {
129 return mac_address_;
130 }
132
135class uwUFetch_NODE : public MMac
136{
137public:
142
146 virtual ~uwUFetch_NODE();
147
158 virtual int command(int argc, const char *const *argv);
159
167 virtual int crLayCommand(ClMessage *m);
168
169protected:
191
232 };
233
244
252
256 class uwUFetch_NODE_timer : public TimerHandler
257 {
258 public:
264 : TimerHandler()
265 , start_time(0.0)
266 , left_duration(0.0)
267 , counter(0)
268 , module(m)
270 {
271 assert(m != NULL);
272 }
273
278
282 virtual void
284 {
287 if (left_duration <= 0.0) {
288 left_duration = module->mac2phy_delay_;
289 }
290 force_cancel();
292 }
293
298 virtual void
300 {
302 start_time = NOW;
303 assert(left_duration > 0);
304 sched(left_duration);
309 }
310
314 virtual void
316 {
318 force_cancel();
319 }
320
326 virtual void
327 schedule(double val)
328 {
329 start_time = NOW;
330 left_duration = val;
332 resched(val);
333 }
334
340 bool
342 {
344 }
345
351 bool
356
362 bool
367
373 bool
378
384 bool
386 {
387 return (timer_status == isRunning() || timer_status == isFroozen());
388 }
389
393 void
395 {
396 counter = 0;
397 }
398
402 void
404 {
405 ++counter;
406 }
407
413 int
415 {
416 return counter;
417 }
418
424 double
426 {
427 return left_duration;
428 }
429
430 protected:
431 double start_time;
435 *module;
438 }; // END class uwUFetch_NODE_timer
439
450 {
451 public:
461
462 /*
463 * Destructor of uwUFetch_BEACON_timer
464 */
466
467 protected:
472 virtual void expire(Event *e);
473
474 }; // END class uwUFetch_BEACON_timer
475
484 {
485 public:
495
500 {
501 }
502
503 protected:
509 virtual void expire(Event *e);
510 }; // end class uwUFetch_BackOffTimer
511
519 {
520 public:
530
531 /*
532 * Destructor of uwUFetch_PROBE_timer
533 */
535
536 protected:
542 virtual void expire(Event *e);
543 }; // END class uwUFetch_PROBE_timer
544
555 {
556 public:
566
567 /*
568 * Destructor of uwUFetch_POLL_timer
569 */
571
572 protected:
578 virtual void expire(Event *e);
579 }; // END class uwUFetch_POLL_timer
580
589 {
590 public:
600
601 /*
602 * Destructor of uwUFetch_DATA_BEFORE_TX_timer class
603 */
605
606 protected:
612 virtual void expire(Event *e);
613 }; // END class uwUFetch_DATA_BEFORE_TX_timer
614
624 {
625 public:
635
636 /*
637 * Destructor of uwUFetch_DATA_timer class
638 */
640
641 protected:
647 virtual void expire(Event *e);
648 }; // END class uwUFetch_DATA_timer
649
659 {
660 public:
670
671 /*
672 * Destructor of uwUFetch_Beacon_timer class
673 */
675
676 protected:
682 virtual void expire(Event *e);
683
684 }; // END class uwUFetch_CBeacon_timer
685
694 {
695 public:
705
706 /*
707 * Destructor of UWUFetch_CTS_timer class
708 */
710
711 protected:
717 virtual void expire(Event *e);
718 }; // END class uwUFetch_CTS_timer
719
729 {
730 public:
740
741 /*
742 * Destructor of uwUFetch_TRIGGER_time class
743 */
745
746 protected:
752 virtual void expire(Event *e);
753 }; // END class uwUFetch_TRIGGER_timer
754
755 /******************************************************************************
756 * GENERAL METHODS *
757 ******************************************************************************/
758
764 virtual void Phy2MacStartRx(const Packet *p);
765
771 virtual void Phy2MacStartRx_HN(const Packet *p);
772
778 virtual void Phy2MacEndRx(Packet *p);
779
786 virtual void Phy2MacEndRx_HN_without(Packet *p);
787
793 virtual void Phy2MacEndRx_HN(Packet *p);
794
801 virtual void Mac2PhyStartTx(Packet *p);
802
809 virtual void Mac2PhyStartTx_HN(Packet *p);
810
819 virtual void Phy2MacEndTx(const Packet *p);
820
829 virtual void Phy2MacEndTx_HN(const Packet *p);
830
837 virtual void recvFromUpperLayers(Packet *p);
838
845 virtual void recvFromUpperLayers_HN(Packet *p);
846
852 virtual void printStateInfo(double delay = 0);
853
858 virtual void initInfo();
859
863 virtual void waitForUser();
864
871 virtual void
873 {
874 last_reason = reason;
875 }
876
877 /*
878 * Refresh the state of the protocol
879 *
880 * @param UWUFETCH_NODE_STATUS current state of the protocol
881 */
882 virtual void
884 {
886 curr_state = state;
887 }
888
889 /******************************************************************************
890 * SENSOR NODE METHODS *
891 ******************************************************************************/
892
896 virtual void stateIdle_NODE();
897
901 virtual void BEACON_rx();
902
906 virtual void BCKTOExpired();
907
911 virtual void state_PROBE_tx();
912
916 virtual void PROBE_tx();
917
922 virtual void state_wait_POLL();
923
929 virtual void PollTOExpired();
930
935 virtual void POLL_rx();
936
941 virtual void state_DATA_NODE_first_tx();
942
948 virtual void DataBeforeTxTOExpired();
949
954 virtual void state_DATA_NODE_tx();
955
960 virtual void state_DATA_NODE_finish_tx();
961
965 virtual void DATA_NODE_tx();
966
972 virtual void state_wait_CBEACON();
973
979 virtual void CBeaconTOExpired();
980
985 virtual void CBEACON_rx();
986
987 /****************************************************************************
988 * HEAD NODE METHODS *
989 ****************************************************************************/
990
994 virtual void stateIdle_HN();
995
1001 virtual void BeaconTxTOExpire();
1002
1007 virtual void state_BEACON_tx();
1008
1012 virtual void BEACON_tx();
1013
1019 virtual void state_wait_PROBE();
1020
1025 virtual void PROBE_rx();
1026
1032 virtual void state_wait_other_PROBE();
1033
1040 virtual void ProbeTOExpired();
1041
1046 virtual void state_POLL_tx();
1047
1051 virtual void POLL_tx();
1052
1058 virtual void state_wait_first_DATA();
1059
1065 virtual void state_wait_other_DATA();
1066
1072 virtual void DataTOExpired();
1073
1078 virtual void DATA_rx();
1079
1084 virtual void state_CBEACON_tx();
1085
1089 virtual void CBEACON_tx();
1090
1096 virtual void TRIGGER_rx();
1097
1103 virtual void TRIGGER_rx_without();
1104
1108 virtual void state_RTS_tx();
1109
1113 virtual void RTS_tx();
1114
1120 virtual void state_wait_CTS();
1121
1126 virtual void CtsTOExpired();
1127
1132 virtual void CTS_rx();
1133
1139 virtual void state_DATA_HN_first_tx();
1140
1146 virtual void state_DATA_HN_first_tx_without();
1147
1153 virtual void state_DATA_HN_tx();
1154
1160 virtual void state_DATA_HN_tx_without();
1161
1167 virtual void state_DATA_HN_finish_tx();
1168
1174 virtual void state_DATA_HN_finish_tx_without();
1175
1181 virtual void DATA_HN_tx();
1182
1188 virtual void DATA_HN_tx_without();
1189
1197 virtual void BCKTOExpired_HN();
1198
1206 virtual void BCKTOExpired_HN_without();
1207
1215 virtual void DataBeforeTxTOExpired_HN();
1216
1217 /******************************************************************************
1218 * METODI AUSILIARI *
1219 ******************************************************************************/
1225 virtual bool isHeadNode();
1226
1234 virtual bool typeCommunication();
1235
1242 virtual bool burstDATA();
1243
1249 virtual double choiceBackOffTimer();
1250
1256 virtual double choiceBackOffTimer_HN();
1257
1265 virtual double getDataTimerValue();
1266
1273
1280
1286 virtual double getRTT();
1287
1294 virtual void updateListProbbedNode();
1295
1296 /******************************************************************************
1297 * METODI get E incr *
1298 * ****************************************************************************/
1299
1300 /**************************
1301 * HEAD NODE *
1302 **************************/
1303
1308 void
1313
1320 int
1322 {
1323 return n_BEACON_pck_tx_by_HN;
1324 };
1325
1330 void
1335
1342 int
1347
1352 void
1354 {
1356 };
1357
1364 int
1366 {
1367 return n_PROBE_pck_rx_by_HN;
1368 };
1369
1374 void
1379
1386 int
1391
1396 void
1401
1408 int
1413
1418 void
1423
1430 int
1432 {
1433 return n_POLL_pck_tx_by_HN;
1434 };
1435
1440 void
1445
1452 int
1457
1462 void
1467
1474 int
1476 {
1477 return n_DATA_pck_rx_by_HN;
1478 };
1479
1484 void
1489
1496 int
1501
1506 void
1511
1518 int
1523
1528 void
1533
1540 int
1542 {
1544 };
1545
1550 void
1555
1562 int
1567
1572 void
1577
1584 int
1586 {
1588 };
1589
1594 void
1599
1606 int
1611
1616 void
1621
1628 int
1633
1638 void
1640 {
1642 };
1643
1650 int
1652 {
1653 return n_RTS_pck_tx_by_HN;
1654 };
1655
1660 void
1665
1672 int
1674 {
1676 };
1677
1682 void
1684 {
1686 };
1687
1694 int
1696 {
1697 return n_CTS_pck_rx_by_HN;
1698 };
1699
1704 void
1709
1716 int
1718 {
1720 };
1721
1726 void
1731
1738 int
1743
1748 void
1753
1760 int
1762 {
1763 return n_DATA_pck_tx_by_HN;
1764 };
1765
1770 void
1775
1782 int
1787
1788 /*********************************
1789 * SENSOR NODE *
1790 *********************************/
1791
1796 void
1801
1808 int
1813
1818 void
1823
1830 int
1835
1840 void
1845
1852 int
1857
1862 void
1867
1874 int
1876 {
1878 };
1879
1884 void
1889
1896 int
1901
1906 void
1911
1918 int
1920 {
1921 return n_POLL_pck_rx_by_NODE;
1922 };
1923
1928 void
1933
1940 int
1945
1950 void
1955
1962 int
1967
1972 void
1977
1984 int
1986 {
1987 return n_DATA_pck_tx_by_NODE;
1988 };
1989
1994 void
1999
2006 int
2011
2016 void
2021
2028 int
2033
2038 void
2043
2050 int
2055
2060 void
2065
2072 int
2077
2078 /****************************************************************************
2079 * SENSOR NODE VARIABLES *
2080 ****************************************************************************/
2081 // TCL variables
2083 double
2088 double T_POLL;
2091 int N_RUN;
2098 int
2102 // Timers
2110 // that the SN transmit
2111 // the successive DATA
2112 // pck to the HN */
2113 uwUFetch_CBeacon_timer CBEACON_timer; // Interval time in which SN is
2114 // enabled to receive CBEACON packet
2115 // from HN */
2116
2117 // Global Variables that should be never reset
2118 double
2129 double
2138 double
2159 int
2174 int
2182 double Tprobe;
2184 double Tdata_NODE;
2187 double RTT;
2188 int
2191 int
2202 double
2206 double
2212 // Variables that should be reseted when a cycle is end
2213 int
2225 int
2238 // Variables that enable or not an operation
2241 bool
2251 // PACKETS create
2256 Packet
2259 Packet
2262 Packet
2266 // Queue
2267 std::queue<Packet *> Q_data;
2269 /******************************************************************************
2270 * HEAD NODE VARIABLES *
2271 ******************************************************************************/
2272 // TCL variables
2273 double
2288 double
2292 int MAX_ALLOWED_CBEACON_TX; // Maximum number of CBEACON cycles that HN can
2293 // start after the transmission of a BEACON
2294 // packet. */
2295 int MAX_PCK_HN_WANT_RX_FROM_NODE; // Maximum number of DATA packets that HN
2296 // want to receive from a single SN during
2297 // a cycle BEACON-PROBE-POLL-DATA-CBEACON
2298 // */
2299 double T_CTS; // Interval time in which HN is enabled to receive a CTS
2300 // packet from AUV */
2304 double
2309 // Timers
2321 // Global Variables that should be never reset
2325 double
2341 double
2350 double
2357 double
2362 double
2374 int
2395 int
2413 int
2420 double Tbeacon;
2422 double
2425 double Trts;
2427 double Tdata_HN;
2443 int
2449 bool CTSrx;
2457 // Variables that should be reseted when a cycle is end
2466 int
2471 int
2480 int
2494 // Variables that enable or not an operation
2497 bool
2512 bool
2516 // PACKETS create
2519 Packet
2539 // QUEUE
2540 std::
2541 queue<Packet *>
2544 std::queue<int> Q_data_source_SN;
2547 std::queue<int> Q_probbed_mac_HN;
2550 std::queue<int>
2554 std::queue<double> Q_probbed_backoff_time;
2560 // EXTRA
2568 static bool
2571 bool
2576 // Mapping
2577 static std::
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>
2591 std::
2592 ofstream fout;
2595 std::ofstream
2598};
2599#endif
Timer associated to the HN.
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.
Class inherited the method and variable of uwUFetch_NODE_timer that handle the timer of CTS packets.
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.
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.
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.
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.
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 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_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.
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_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_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_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_TRANSMIT_DATA
@ UWUFETCH_NODE_STATUS_TRANSMIT_BEACON
@ 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.
double backoff_time_
int n_pcks_NODE_want_tx_
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