DESERT 3.5.1
Loading...
Searching...
No Matches
uwUFetch_AUV.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
37#ifndef UWUFETCH_AUV_H_
38#define UWUFETCH_AUV_H_
39
40#include <mmac.h>
41#include <iostream>
42#include <clmessage.h>
43#include <mphy.h>
44#include <string>
45#include <fstream>
46#include <ostream>
47#include <cassert>
48#include <map>
49#include <queue>
50
51#define UWFETCH_AUV_DROP_REASON_ERROR \
52 "DERR"
53#define UWFETCH_AUV_DROP_REASON_UNKNOWN_TYPE \
54 "DUT"
55#define UWFETCH_AUV_DROP_REASON_WRONG_RECEIVER \
56 "DWR"
57#define UWFETCH_AUV_DROP_REASON_WRONG_STATE \
58 "DWS"
60#define UWFETCH_AUV_DROP_PHY_CAN_NOT_TX \
61 "PNT"
62#define UWFETCH_AUV_DROP_REASON_ALREADY_ONE_RTS_RX \
63 "DAORR"
64#define UUFETCH_AUV_DROP_REASON_NOT_ENABLE \
65 "PDNE"
67#define UWUFETCH_AUV_DROP_CAN_NOT_RX_THIS_PCK \
68 "DCNR"
71extern packet_t
73extern packet_t PT_RTS_UFETCH;
74extern packet_t PT_CTS_UFETCH;
75extern packet_t PT_BEACON_UFETCH;
76extern packet_t PT_PROBE_UFETCH;
77extern packet_t PT_POLL_UFETCH;
78extern packet_t
84class uwUFetch_AUV : public MMac
85{
86public:
91
95 virtual ~uwUFetch_AUV();
96
107 virtual int command(int argc, const char *const *argv);
108
116 virtual int crLayCommand(ClMessage *m);
117
118protected:
129
156
164
172
176 class uwUFetch_timer : public TimerHandler
177 {
178 public:
184 : TimerHandler()
185 , start_time(0.0)
186 , left_duration(0.0)
187 , counter(0)
188 , module(m)
190 {
191 assert(m != NULL);
192 }
193
197 virtual ~uwUFetch_timer(){};
198
202 virtual void
204 {
207 if (left_duration <= 0.0) {
208 left_duration = module->mac2phy_delay_;
209 }
210 force_cancel();
212 }
213
218 virtual void
220 {
222 start_time = NOW;
223 assert(left_duration > 0);
224 sched(left_duration);
229 }
230
234 virtual void
236 {
238 force_cancel();
239 }
240
246 virtual void
247 schedule(double val)
248 {
249 start_time = NOW;
250 left_duration = val;
252 resched(val);
253 }
254
260 bool
262 {
264 }
265
271 bool
276
282 bool
287
293 bool
298
304 bool
306 {
307 return (timer_status == isRunning() || timer_status == isFroozen());
308 }
309
313 void
315 {
316 counter = 0;
317 }
318
322 void
324 {
325 ++counter;
326 }
327
333 int
335 {
336 return counter;
337 }
338
344 double
346 {
347 return left_duration;
348 }
349
350 protected:
351 double start_time;
354 uwUFetch_AUV *module;
357 }; // END class uwUFetch_timer
358
367 {
368 public:
378
379 /*
380 * Destructor of uwUFetch_TRIGGER_timer
381 */
383 {
384 }
385
386 protected:
392 virtual void expire(Event *e);
393 }; // END class uwUFetch_TRIGGER_timer
394
403 {
404 public:
414
415 /*
416 * Destructor of uwUFetch_RTS_timer
417 */
419 {
420 }
421
422 protected:
428 virtual void expire(Event *e);
429 }; // END class UWUFetch_RTS_timer
430
439 {
440 public:
450
451 /*
452 * Destructor of uwUFetch_DATA_timer
453 */
455 {
456 }
457
458 protected:
464 virtual void expire(Event *e);
465 }; // END class UWUFetch_DATA_timer uwUFetch_FIRST_DATA_timer
466
480 {
481 public:
490
491 /*
492 * Destructor of uwUFetch_FIRST_DATA_timer
493 */
495 {
496 }
497
498 protected:
504 virtual void expire(Event *e);
505 }; // END class uwUFetch_FIRST_DATA_timer
506
507 /****************************************************************************
508 * GENERAL METHODS *
509 ****************************************************************************/
515 virtual void Phy2MacStartRx(const Packet *p);
516
523 virtual void Phy2MacStartRx_without(const Packet *p);
524
530 virtual void Phy2MacEndRx(Packet *p);
531
538 virtual void Phy2MacEndRx_without(Packet *p);
539
546 virtual void Mac2PhyStartTx(Packet *p);
547
555 virtual void Mac2PhyStartTx_without(Packet *p);
556
565 virtual void Phy2MacEndTx(const Packet *p);
566
576 virtual void Phy2MacEndTx_without(const Packet *p);
577
583 virtual void printStateInfo(double delay = 0);
584
589 virtual void initInfo();
590
594 virtual void waitForUser();
595
601 virtual void
603 {
604 last_reason = reason;
605 }
606
612 virtual void
614 {
616 curr_state = state;
617 }
618
619 /*****************************************************************************
620 * AUV METHODS *
621 *****************************************************************************/
625 virtual void stateIdle_AUV();
626
631 virtual void TriggerTOExpired();
632
637 virtual void state_TRIGGER_tx();
638
643 virtual void state_TRIGGER_tx_without();
644
648 virtual void TRIGGER_tx();
649
653 virtual void state_wait_RTS();
654
658 virtual void RTS_rx();
659
663 virtual void RtsTOExpired();
664
668 virtual void state_CTS_tx();
669
673 virtual void CTS_tx();
674
679 virtual void state_wait_first_DATA();
680
685 virtual void state_wait_first_DATA_without();
686
691 virtual void DATA_rx();
692
696 virtual void state_wait_DATA();
697
702 virtual void DataTOExpired();
703
710 virtual void DataTOExpired_first();
711
716 virtual void updateQueueRTS();
717
718 /*****************************************************************************
719 * METODI AUSILIARI *
720 *****************************************************************************/
728 virtual bool typeCommunication();
729
736 virtual double getDataTimerValue();
737
745
751 virtual double getRTT();
752
758 virtual void another_DATA_received();
759
760 /*****************************************************************************
761 * Metodi get & incr *
762 *****************************************************************************/
763
768 void
773
780 int
782 {
783 return n_TRIGGER_tx_by_AUV;
784 }
785
789 void
794
801 int
806
810 void
812 {
814 }
815
822 int
824 {
825 return n_RTS_rx_by_AUV;
826 }
827
831 void
836
843 int
848
852 void
857
864 int
869
873 void
875 {
877 }
878
884 int
886 {
887 return n_CTS_tx_by_AUV;
888 }
889
893 void
898
904 int
909
913 void
918
925 int
927 {
928 return n_DATA_rx_by_AUV;
929 }
930
934 void
939
946 int
951
955 void
960
967 int
972
973 /*****************************************************************************
974 * VARIABLES OF AUV NODE *
975 *****************************************************************************/
976 // TCL VARIABLES
977 double T_MIN_RTS;
979 double T_MAX_RTS;
981 double T_GUARD;
983 double T_RTS;
989 // TIMERS
1003 // GLOBAL VARIABLES THAT SHOULD BE NEVER RESET
1011 int N_RUN;
1020 double
1033 int
1049 int
1054 int
1058 int
1065 double Trts;
1067 double Tcts;
1069 double
1072 double RTT;
1079 int index;
1080 int
1083 int
1086 int
1089 int
1092 int
1096 // VARIABLES THAT ENABLES OR NOT AN OPERATION
1106 // VARIABLES THAT SHOULD BE RESETED WHEN A CYCLE IS ENDED
1114 int
1119 // PACKETS CREATED
1129 // STRUCTURES USED
1130 std::queue<Packet *> Q_data_AUV;
1132 std::queue<int> Q_rts_mac_HN;
1138 std::queue<double> Q_rts_backoff_time;
1142 // VARIABLES THAT INDICATE IN WHICH STATE THE NODE IS IN THAT MOMENT AND THE
1143 // REASON BECAUSE THE NODE PASS FROM A STATE TO ANOTHER ONE
1151 static std::map<UWUFETCH_AUV_STATUS, std::string>
1154 static std::map<UWUFETCH_AUV_STATUS_CHANGE, std::string>
1157 static std::
1158 map<UWUFETCH_AUV_PACKET_TYPE, std::string>
1161 static std::map<UWUFETCH_TIMER_STATUS, std::string>
1165 // VARIABLES FOR DEBUG
1166 std::
1167 ofstream fout;
1170 std::ofstream
1173 static bool
1176 bool
1180 static const int MAX_RTS_RX =
1181 100;
1183}; // END class UWUFetch_AUV
1184
1185#endif
Class inherited the method and variable of uwUFetch_timer that handle the timer of DATA packets.
uwUFetch_DATA_timer(uwUFetch_AUV *m)
Constructor of uwUFetch_DATA_timer class.
virtual void expire(Event *e)
Method called when the timer expire.
Class inherited the method and variable of uwUFetch_timer that handle the timer of DATA packets.
virtual void expire(Event *e)
Method called when the timer expire.
uwUFetch_FIRST_DATA_timer(uwUFetch_AUV *m)
Constructor of uwUFetch_FIRST_DATA_timer class.
Class inherited the method and variable of uwUFetch_timer that handle the timer of RTS packets.
uwUFetch_RTS_timer(uwUFetch_AUV *m)
Constructor of uwUFetch_RTS_timer class.
virtual void expire(Event *e)
Method called when the timer expire.
Class inherited the method and variable of uwUFetch_timer that handle the timer of TRIGGER packets.
virtual void expire(Event *e)
Method called when the timer expire.
uwUFetch_TRIGGER_timer(uwUFetch_AUV *m)
Constructor of uwUFetch_TRIGGER_timer class.
Class that handle the timers of AUV node.
virtual void stop()
Stop the timer.
void incrCounter()
Increment the counter by one value.
void resetCounter()
Reset the counter that scan the timer.
double getDuration()
Left duration of the timer.
int counter
Counter of the timer.
virtual void freeze()
Freeze the timer.
uwUFetch_timer(uwUFetch_AUV *m)
Constructor of uwUFetch_timer class.
double left_duration
Left duration of the timer.
virtual void schedule(double val)
Schedule a timer.
bool isRunning()
Verify if the timer is RUNNING.
bool isActive()
Verify if the timer is ACTIVE.
bool isFroozen()
Verify if the timer is FROZEN.
virtual ~uwUFetch_timer()
Destructor of uwUFetch_timer class.
double start_time
Time to start the timer.
uwUFetch_AUV *UWUFETCH_TIMER_STATUS timer_status
< Pointer to an object of type uwUFetch_AUV
bool isExpired()
Verify if the timer is EXPIRED.
virtual void unFreeze()
unFreeze are used after a freezing of the timer.
int getCounter()
Counter value.
bool isIdle()
Verify if the timer is IDLE.
Class that represent the UFetch mac layer for AUV node.
@ UWUFETCH_AUV_PACKET_TYPE_CTS
@ UWUFETCH_AUV_PACKET_TYPE_TRIGGER
@ UWUFETCH_AUV_PACKET_TYPE_DATA
@ UWUFETCH_AUV_PACKET_TYPE_RTS
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
int num_pck_hn_1
Counter of the correct DATA packets received by HN 1 from SNs.
double tx_CTS_start_time
Indicates when AUV start a transmission of CTS packet.
virtual double getDataTimerValue()
Compute the length of time interval within AUV want to receive all DATA packet from specifical HN.
int getTrigger_Tx_by_AUV()
Number of TRIGGER packets transmitted during the simulation during the single cycle.
int n_DATA_rx_by_AUV
Counter of the number of DATA packets transmitted by AUV during a single cycle of simulation.
uwUFetch_FIRST_DATA_timer DATA_timer_first_pck
Interval time in which the AUV want to receive the first DATA packet from the HN.
int n_RTS_rx_by_AUV
Counter of the number of RTS packets received by AUV during a single cycle of simulation.
int getTotal_Data_Rx_by_AUV()
Total number of DATA packets received by AUV from all HNs of the netwrok during the simulation.
uwUFetch_RTS_timer RTS_timer
Interval time in which the AUV wait a RTS packets from the HNs.
int HEAD_NODE_4
Id number of HN 4.
virtual void Phy2MacEndTx(const Packet *p)
Handle the end-of-PHY-transmission event.
int n_tot_RTS_rx_by_AUV
Counter of the number of RTS packets received by AUV during an entire duration of simulation.
double MAX_PAYLOAD
Maximum size of DATA PAYLOAD packet.
int num_pck_hn_3
Counter of the correct DATA packets received by HN 3 from SNs.
int number_data_pck_AUV_rx_exact
Number of DATA packets that AUV want exactly received from the HN.
double rx_RTS_start_time
Indicates when AUV start the reception of RTS packet.
int n_tot_TRIGGER_tx_by_AUV
Counter of the number of TRIGGER packets transmitted by AUV during an entire duration of simulation.
UWUFETCH_AUV_STATUS prev_state
Previous state in which the node it was located.
virtual void state_TRIGGER_tx_without()
Initialization of TRIGGER packet that will be forwarded in broadcast to the HNs.
double data_timeout
Interval time within AUV want to receive all DATA packets from the HN.
void incrData_Rx_by_AUV()
Increase of 1 the number of DATA packets received by AUV.
double tx_TRIGGER_finish_time
Indicates when AUV end the transmission of TRIGGER packet.
int HEAD_NODE_2
Id number of HN 2.
int NUM_MAX_DATA_AUV_WANT_RX
Maximum number of data packet that AUV want to receive from the HN in a single cycle of TRIGGER-RTS-C...
uwUFetch_AUV()
Constructor of the class UWUFetch.
bool txTRIGGEREnabled
true if AUV is enabled to transmit a TRIGGER packet
UWUFETCH_AUV_STATUS_CHANGE last_reason
Last reason because the NODE change his state.
std::queue< int > Q_rts_n_pcks_HN_want_tx_AUV
Queue that store the number of DATA packets that the single HN want to tx to the AUV.
int debugMio_
Used if we want to create the logging file.
virtual double getRTT()
Compute the Round Trip Time.
UWUFETCH_AUV_STATUS curr_state
Current state in which the node is located.
std::ofstream out_file_logging
Variable that handle the file in which the protocol write the statistics.
int n_tot_DATA_rx_by_AUV
Counter of the number of DATA packets received by AUV during an entire duration of simulation.
int mac_addr_HN_ctsed
Mac address of the HN from which the AUV want to receive the DATA packets.
int n_TRIGGER_tx_by_AUV
Counter of the number of TRIGGER packets transmitted by AUV during a single cycle of simulation.
double Tdata
Time needed to transmit a DATA packet.
void incrTotal_Data_Rx_by_AUV()
Increase of 1 the number of DATA packets received by AUV.
virtual void state_CTS_tx()
Initialization of CTS packet that will be forwarded to the specifical HN.
int NUM_HN_NET
Number of Head Nodes in the network.
virtual void DataTOExpired_first()
Timeout within received the FIRST DATA packet from HN that it has sent a CTS packet is expired.
double RTT
Round Trip Time.
double rx_RTS_finish_time
Indicates when AUV end the reception of RTS packet.
virtual void refreshReason(UWUFETCH_AUV_STATUS_CHANGE reason)
Refresh the reason for the changing of the state.
int HEAD_NODE_1
Id number of HN 1.
std::ofstream fout
Variable that handle the file in which the protocol write the state transition for debug purposes.
virtual void updateQueueRTS()
Remove the information relative to the HN from which AUV wanted and it has finished to receive DATA p...
void incrTotalRts_Rx_corrupted_by_AUV()
Increase of 1 the number of corrupted RTS packets received by AUV.
@ UWUFETCH_AUV_STATUS_CHANGE_PACKET_FOR_ANOTHER_NODE
@ UWFETCH_AUV_STATUS_CHANGE_PACKET_ERROR
@ UWUFETCH_AUV_STATUS_CHANGE_RTS_TO_EXPIRED_0_RTS_RX
@ UWUFETCH_AUV_STATUS_CHANGE_TRIGGER_TO_EXPIRED
@ UWUFETCH_AUV_STATUS_CHANGE_TRIGGER_INITIALIZE_TX_TRIGGER
@ UWUFETCH_AUV_STATUS_CHANGE_RTS_RX
@ UWUFETCH_AUV_STATUS_CHANGE_TO_WAIT_RTS_EXPIRED
@ UWUFETCH_AUV_STATUS_CHANGE_RTS_TO_EXPIRED_AT_LEAST_ONE_RTS_RX
@ UWUFETCH_AUV_STATUS_CHANGE_CTS_INITIALIZED_TX_CTS
@ UWUFETCH_AUV_STATUS_CHANGE_RTS_FINISHED_TO_RX
@ UWUFETCH_AUV_STATUS_CHANGE_CTS_TX
@ UWUFETCH_AUV_STATUS_CHANGE_PHY_CAN_NOT_TX
@ UWUFETCH_AUV_STATUS_CHANGE_TRIGGER_TX
@ UWUFETCH_AUV_STATUS_CHANGE_TRIGGER_TX_WAIT_RTS
@ UWUFETCH_AUV_STATUS_CHANGE_DATA_PCK_FINISHED_TO_RX
@ UWUFETCH_AUV_STATUS_CHANGE_DATA_PCK_RX
@ UWUFETCH_AUV_STATUS_CHANGE_RTS_FINSHED_TO_STORE
@ UWUFETCH_AUV_STATUS_CHANGE_TO_WAIT_DATA_EXPIRED
@ UWUFETCH_AUV_STATUS_CHANGE_PACKET_IS_IN_ERROR
@ UWUFETCH_AUV_STATUS_CHANGE_ANOTHER_DATA_PCK_RX
@ UWUFETCH_AUV_STATUS_CHANGE_CTS_TX_WAIT_DATA
@ UWFETCH_AUV_STATUS_CHANGE_PACKET_FOR_ANOTHER_NODE
@ UWUFETCH_AUV_STATUS_CHANGE_LAST_DATA_PCK_RX
int mode_comm_hn_auv
Indicate how the communication takes place with or without RTS-CTS packets.
int getTotalCts_Tx_by_AUV()
Total number of CTS packets transmitted by AUV during the simulation.
virtual void Phy2MacStartRx_without(const Packet *p)
Handle the detected-start-of-PHY-reception event in the case protocol doesn't use RTS and CTS packets...
virtual void Mac2PhyStartTx(Packet *p)
This method must be called by the MAC to instruct the PHY to start the transmission of a packet.
virtual void DataTOExpired()
Timeout within received DATA packets is expired.
int num_pck_hn_2
Counter of the correct DATA packets received by HN 2 from SNs.
virtual void computeTxTime(UWUFETCH_AUV_PACKET_TYPE tp)
Compute the transmission time for a specifical type of packet.
int HEAD_NODE_3
Id number of HN 3.
int N_RUN
Number of run in execution
void incrTotalRts_Rx_by_AUV()
Increase of 1 the number of RTS packets received by AUV.
std::queue< double > Q_rts_backoff_time
Queue that stored the backoff time choice by the single HN before to transmit RTS packet.
double Tcts
Time needed to transmit a CTS packet.
double T_MAX_RTS
Upper bound of the interval in which HN choice the back-off time to tx RTS pck.
int n_tot_CTS_tx_by_AUV
Counter of the number of CTS packets transmitted by AUV during an entire duration of simulation.
void incrTotalCts_Tx_by_AUV()
Increase of 1 the number of CTS packets transmitted by AUV.
int n_tot_DATA_rx_corr_by_AUV
Counter of the number of DATA packets corrupted received by AUV during an entire duration of simulati...
double T_MIN_RTS
Lower bound of the interval in which HN choice the back-off time to tx RTS pck.
double tx_TRIGGER_start_time
Indicates when AUV start a transmission of TRIGGER packet.
virtual void state_TRIGGER_tx()
Initialization of TRIGGER packet that will be forwarded in broadcast to the HNs.
virtual void state_wait_DATA()
AUV is waiting the SECOND and successive DATA packets from HN.
static std::map< UWUFETCH_AUV_PACKET_TYPE, std::string > packetType
Map the UWUFETCH_AUV_PACKET_TYPE to the description of packet type.
bool rxRTSEnabled
true if AUV is enabled to receive a RTS packet
Packet * curr_CTS_pck_tx
Pointer to the CTS packet that is being transmitted by AUV.
uwUFetch_TRIGGER_timer Trigger_timer
Interval time.
virtual void another_DATA_received()
Verify whether AUV must to receive another DATA packet from the HN to whome It has transmitted the TR...
void incrCts_Tx_by_AUV()
Increase of 1 the number of CTS packets transmitted by AUV.
void incrTotalTrigger_Tx_by_AUV()
Increase of 1 the number of TRIGGER packets transmitted by AUV.
double T_START_PROC_TRIGGER
Time before that the AUV start the procedure to transmit a TRIGGER packet.
int getTotal_Data_Rx_corrupted_by_AUV()
Total number of corrupted DATA packets received by the AUV from all HNs of the network.
std::queue< int > Q_rts_mac_HN
Queue of HN MAC address from which AUV has received correctly the RTS packet.
int getRts_Rx_by_AUV()
Number of RTS packets received by AUV after the transmission of TRIGGER packet.
int mac_addr_hn_triggered
MAC address of the HN triggered by the AUV.
int hn_trigg
Index of the HN that will be triggered with the next cycle of TRIGGER-RTS-CTS.
virtual void Mac2PhyStartTx_without(Packet *p)
This method must be called by the MAC to instruct the PHY to start the transmission of a packet in th...
int getTotalRts_Rx_by_AUV()
Total number of RTS received by AUV during the simulation from all HNs of the network.
virtual void state_wait_first_DATA_without()
AUV is waiting the FIRST DATA packet from the HN to whom It has sent only RTS packet.
int n_CTS_tx_by_AUV
Counter of the number of CTS packets transmitted by AUV during a single cycle of simulation.
static std::map< UWUFETCH_TIMER_STATUS, std::string > statusTimer
Map the UWUFETCH_TIMER_STATUS to the description of the timers.
int getCts_Tx_by_AUV()
Number of CTS packets transmitted by AUV to the HN.
void incrTrigger_Tx_by_AUV()
Increment by 1 the number of TRIGGER packets transmitted by AUV during a single cycle TRIGGER-RTS-CTS...
static bool initialized
Indicate if the protocol has been initialized or not.
double Trts
Time needed to transmit a RTS packet.
double T_GUARD
Guard time interval used between two consecutive transmissions of data packets.
Packet * curr_DATA_pck_rx
Pointer to the DATA packet that is being received by AUV.
UWUFETCH_AUV_STATUS
< States in which the AUV node may be during Its execution
@ UWUFETCH_AUV_STATUS_RECEIVE_RTS_PACKET
@ UWUFETCH_AUV_STATUS_TRANSMIT_CTS_PACKET
@ UWUFETCH_AUV_STATUS_WAIT_RTS_PACKET
@ UWUFETCH_AUV_STATUS_RECEIVE_DATA_PACKET
@ UWUFETCH_AUV_STATUS_WAIT_DATA_HN
@ UWUFETCH_AUV_STATUS_TRANSMIT_TRIGGER
virtual void waitForUser()
Method used for debug.
int getData_Rx_by_AUV()
Number of DATA packets received by AUV after the transmission of TRIGGER-RTS-CTS packets from a speci...
virtual ~uwUFetch_AUV()
Destructor of the class UWUFetch.
uwUFetch_DATA_timer DATA_timer
Interval time in which the AUV want to receive all DATA packets from the HN.
virtual void Phy2MacEndRx_without(Packet *p)
Handle the end-of-PHY-reception event in the case protocol doesn't use RTS and CTS packets.
static const int MAX_RTS_RX
Maximum number of RTS packets that AUV can receive.
double T_RTS
Interval time in which the AUV want to receive an RTS packet in answer to the trigger.
virtual void Phy2MacEndTx_without(const Packet *p)
Handle the end-of-PHY-transmission event in the case protocol doesn't use RTS and CTS packets.
virtual void RTS_rx()
AUV has received RTS packet.
bool rxDATAEnabled
true if AUV is enabled to receive a DATA packet
std::queue< Packet * > Q_data_AUV
Queue of DATA packets stored by the AUV and received from HNs.
double rx_DATA_finish_time
Indicates when AUV end the reception of DATA packet.
int num_pck_hn_4
Counter of the correct DATA packets received by HN 4 from SNs.
virtual void DATA_rx()
AUV has received a DATA packet from HN.
virtual void refreshState(UWUFETCH_AUV_STATUS state)
Refresh the state of the protocol.
int last_hn_triggered
Index of the HN that was triggered in the previous cycle by the AUV.
virtual void initInfo()
Initialize the protocol at the beginning of the simulation.
double rx_DATA_start_time
Indicates when AUV start the reception of DATA packet.
static std::map< UWUFETCH_AUV_STATUS_CHANGE, std::string > statusChange
Map the UWUFETCH_AUV_STATUS_CHANGE to the description the reason of changing state.
Packet * curr_RTS_pck_rx
Pointer to the RTS packet that is being received by AUV.
int getTotalRts_Rx_corrupted_by_AUV()
Total number of corrupted RTS packets received by AUV from all HNs of the network.
int mac_addr_HN_in_data
MAC address of the HN from which the AUV has received the DATA packet
virtual void state_wait_first_DATA()
AUV is waiting the FIRST DATA packet from the HN to whom It has sent a RTS and CTS packet.
double T_tx_TRIGGER
Time required to transimt a single TRIGGER packet.
virtual void printStateInfo(double delay=0)
Prints a file with every state change for debug purposes.
int n_tot_RTS_rx_corr_by_AUV
Counter of the number of RTS packets corrupted received by AUV during an entire duration of simulatio...
virtual void stateIdle_AUV()
Idle state.
void incrTotal_Data_Rx_corrupted_by_AUV()
Increase of 1 the number of corrupted DATA packets received by AUV.
virtual void TriggerTOExpired()
Timeout trigger is expired.
virtual void Phy2MacEndRx(Packet *p)
Handle the end-of-PHY-reception event.
Packet * curr_TRIGGER_pck_tx
Pointer to the TRIGGER packet that is being transmitted by AUV.
virtual void Phy2MacStartRx(const Packet *p)
Handle the detected-start-of-PHY-reception event.
bool txCTSEnabled
true if AUV is enabled to transmit a CTS packet
virtual void state_wait_RTS()
AUV is wait a RTS packet from HNs.
virtual void RtsTOExpired()
Timeout within AUV is enabled to receive RTS packet is expired.
virtual void CTS_tx()
Transmission of CTS packet.
void incrRts_Rx_by_AUV()
Increase of 1 the number of RTS packets received by AUV.
virtual void TRIGGER_tx()
Trasmission of TRIGGER packet.
@ UWUFETCH_TIMER_STATUS_IDLE
@ UWUFETCH_TIMER_STATUS_EXPIRED
@ UWUFETCH_TIMER_STATUS_FROZEN
@ UWUFETCH_TIMER_STATUS_RUNNING
virtual bool typeCommunication()
Establish whether the communication between SN and AUV take place with RTS and CTS or only using TRIG...
virtual int crLayCommand(ClMessage *m)
Cross-Layer messages interpreter.
bool print_transitions
true if the writing of state transitions in the file is enabled.
int getTotalTrigger_Tx_by_AUV()
Total number of TRIGGER packets transmitted by the AUV during the simulation.
static std::map< UWUFETCH_AUV_STATUS, std::string > statusInfo
Map the UWUFETCH_AUV_STATUS to the description of each state.
double tx_CTS_finish_time
Indicates when AUV end the transmission of CTS packet.
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