DESERT 3.5.1
Loading...
Searching...
No Matches
uwpolling_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
38#ifndef UWPOLLING_HDR_AUV_H
39#define UWPOLLING_HDR_AUV_H
40
41#include "uwpolling_cmn_hdr.h"
42
43#include <mmac.h>
44#include <mphy.h>
45#include <clmessage.h>
46#include <iostream>
47#include <string>
48#include <map>
49#include <set>
50#include <queue>
51#include <fstream>
52#include <ostream>
53#include <chrono>
54#include "uwsmposition.h"
55
56#define UWPOLLING_AUV_DROP_REASON_ERROR "DERR"
57#define UWPOLLING_AUV_DROP_REASON_UNKNOWN_TYPE \
58 "DUT"
59#define UWPOLLING_AUV_DROP_REASON_WRONG_RECEIVER \
60 "DWR"
61#define UWPOLLING_AUV_DROP_REASON_WRONG_STATE \
62 "DWS"
63#define UWPOLLING_AUV_DROP_REASON_BUFFER_FULL "ADBF"
64
65#define ENTRY_MAX_SIZE 256
66
88
93typedef struct probbed_node {
94 uint id_node;
95 int
99 double time_stamp;
101 //double backoff_time; /**< Backoff time chosen by the node before
102 // transmitting the PROBE */
103 double
106 bool is_sink_;
108 uint16_t id_ack;
116 inline double &
118 {
119 return (time_stamp);
120 }
121
125 inline uint &
127 {
128 return (id_node);
129 }
130
134 inline int &
136 {
137 return (n_pkts);
138 }
139
143 inline int &
145 {
146 return (mac_address);
147 }
148
152 inline bool &
154 {
155 return is_sink_;
156 }
157
161 inline uint16_t &
163 {
164 return id_ack;
165 }
166
170 inline double &
172 {
173 return policy_weight;
174 }
175
177
181class Uwpolling_AUV : public MMac
182{
183public:
191 virtual ~Uwpolling_AUV();
192
203 virtual int command(int argc, const char *const *argv);
211 virtual int crLayCommand(ClMessage *m);
212
213protected:
214 /***********************************
215 | Internal variable and functions |
216 ***********************************/
217
231
245
253
261
265 class Uwpolling_AUV_Timer : public TimerHandler
266 {
267 public:
273 : TimerHandler()
274 , start_time(0.0)
275 , left_duration(0.0)
276 , counter(0)
277 , module(m)
279 {
280 assert(m != NULL);
281 }
282
287 {
288 }
289
293 virtual void
295 {
297 left_duration -= (NOW - start_time);
298 if (left_duration <= 0.0) {
299 left_duration = module->mac2phy_delay_;
300 }
301 force_cancel();
303 }
304
309 virtual void
311 {
313 start_time = NOW;
314 assert(left_duration > 0);
315 sched(left_duration);
317 }
318
322 virtual void
324 {
326 force_cancel();
327 }
328
333 virtual void
334 schedule(double val)
335 {
336 start_time = NOW;
337 left_duration = val;
339 resched(val);
340 }
341
346 bool
348 {
349 return (timer_status == UWPOLLING_IDLE);
350 }
351
356 bool
358 {
360 }
361
366 bool
368 {
370 }
371
376 bool
378 {
379 return (timer_status == UWPOLLING_FROZEN);
380 }
381
386 bool
388 {
389 return (timer_status == UWPOLLING_FROZEN ||
391 }
392
396 void
398 {
399 counter = 0;
400 }
401
405 void
407 {
408 ++counter;
409 }
410
415 int
417 {
418 return counter;
419 }
420
425 double
427 {
428 return left_duration;
429 }
430
431 protected:
432 double start_time;
436 *module;
438 };
439
450 {
451 public:
460
464 virtual ~DataTimer()
465 {
466 }
467
468 protected:
473 virtual void expire(Event *e);
474 };
475
483 {
484 public:
492
497 virtual ~ProbeTimer()
498 {
499 }
500
501 protected:
506 virtual void expire(Event *e);
507 };
508
510 {
511 public:
519
524 virtual ~PollTimer()
525 {
526 }
527
528 protected:
533 virtual void expire(Event *e);
534 };
535
537 {
538 public:
546
551 virtual ~AckTimer()
552 {
553 }
554
555 protected:
560 virtual void expire(Event *e);
561 };
562
563
567 double getMaxBackoffTime();
568
579 virtual double linearInterpolator(
580 double x, double x1, double x2, double y1, double y2);
581
582
588 virtual void Mac2PhyStartTx(Packet *p);
589
595 virtual void Phy2MacEndTx(const Packet *p);
601 virtual void Phy2MacStartRx(const Packet *p);
607 virtual void Phy2MacEndRx(Packet *p);
608
614 inline void
616 {
617 n_trigger_tx++;
618 }
619
624 inline void
626 {
627 n_probe_rx++;
628 }
629
634 inline void
636 {
637 n_ack_rx++;
638 }
639
646 inline void
651
656 inline void
661
666 inline void
671
678 inline void
683
687 inline void
689 {
690 n_poll_tx++;
691 }
692
697 inline int
699 {
700 return n_trigger_tx;
701 }
702
707 inline int
709 {
710 return n_probe_rx;
711 }
712
717 inline int
719 {
720 return n_ack_rx;
721 }
722
728 inline int
733
738 inline int
740 {
741 return n_poll_tx;
742 }
743
748 inline int
750 {
752 }
753
758 inline int
760 {
761 return n_dropped_ack_pkts;
762 }
763
771 inline int
776
781 virtual void
786
791 virtual void
793 {
795 curr_state = state;
796 }
801 virtual void stateRxProbe();
805 virtual void stateRxData();
809 virtual void stateWaitProbe();
813 virtual void stateWaitData();
817 virtual void stateIdle();
821 virtual void stateTxTrigger();
825 virtual void stateTxPoll();
826
830 virtual void DataTOExpired();
834 virtual void ProbeTOExpired();
839 // virtual void printStateInfo(double delay = 0);
847 virtual void initInfo();
851 virtual void TxTrigger();
855 virtual void TxPoll();
861 virtual void SortNode2Poll();
866 virtual void ChangeNodePolled();
873 virtual double GetDataTimerValue();
881 virtual void computeTxTime(UWPOLLING_PKT_TYPE pkt);
887 virtual void UpdateRTT();
893 virtual void stop_count_time();
894
900 inline double
902 {
903 return total_time;
904 }
909 virtual void waitForUser();
914 inline unsigned long int
916 {
917 unsigned long int timestamp =
918 (unsigned long int) (std::chrono::duration_cast<std::chrono::milliseconds>(
919 std::chrono::system_clock::now().time_since_epoch()).count() );
920 return timestamp;
921 }
922
928 virtual void recvFromUpperLayers(Packet *p);
929
934 virtual void stateTx();
935
939 virtual void stateTxData();
940
944 virtual void txData();
945
949 virtual void stateWaitAck();
950
955 virtual void ackTOExpired();
956
960 virtual void stateAckRx();
961
966 virtual void handleAck();
967
971 virtual void handleNoAck();
972
976 virtual void handleProbeAck();
977
981 virtual void addNode2List();
982
986 virtual void addSink2List();
987
993 virtual uint16_t getPollTime();
994
998 virtual uint getRxPkts(int mac_addr);
999
1005 bool initBackoffLUT();
1006
1007 // timers
1013 // internal AUV structure for list of polled node
1014 std::vector<probbed_node> list_probbed_node;
1019 // pointer to packets
1027 // input parameters via TCL
1028 double T_probe;
1033 double T_min;
1035 double T_max;
1037 double T_guard;
1038 int
1041 int
1046 int
1050 int n_run; /*< ID of the experiments (used during sea trial) */
1051
1052 // states of protocol and reasons
1058 // mapping
1059 static std::
1060 map<UWPOLLING_PKT_TYPE, std::string>
1063 static std::
1064 map<UWPOLLING_AUV_STATUS, std::string>
1067 static std::
1068 map<UWPOLLING_AUV_REASON, std::string>
1072 static bool
1078 bool
1083 double distance;
1086 int
1093 // statistics
1094
1095 //double curr_backoff_time; /**< backoff time of the node polled */
1096 double curr_RTT;
1100 double probe_rtt;
1110 bool begin;
1111 double stop_time;
1113 double pkt_time;
1114 double total_time;
1116 double Tdata;
1117 double Tprobe;
1118 double Ttrigger;
1119 double Tpoll;
1129 std::
1130 ofstream fout;
1133 std::ofstream out_file_stats;
1136 std::deque<Packet *> tx_buffer;
1137 std::deque<Packet *> temp_buffer;
1140 uint16_t uid_tx_pkt;
1149 uint16_t last_pkt_uid;
1152 bool acked;
1156 std::map<int, uint>rx_pkts_map;
1159 std::string backoff_LUT_file;
1161 std::map<double, double>backoff_LUT;
1167};
1168#endif
virtual void expire(Event *e)
Method call when the timer expire.
AckTimer(Uwpolling_AUV *m)
Conscructor of AckTimer class.
virtual ~AckTimer()
Destructor of AckTimer class.
Class (inherited from Uwpolling_AUV_Timer) used to handle the timer of data packets When the AUV give...
virtual void expire(Event *e)
Method called when the timer expire.
DataTimer(Uwpolling_AUV *m)
Conscructor of DataTimer class.
virtual ~DataTimer()
Destructor of DataTimer class.
PollTimer(Uwpolling_AUV *m)
Conscructor of ProbeTimer class.
virtual ~PollTimer()
Destructor of ProbeTimer class.
virtual void expire(Event *e)
Method call when the timer expire.
Class (inherited from Uwpolling_AUV_Timer) used to handle the Probe Timer.
ProbeTimer(Uwpolling_AUV *m)
Conscructor of ProbeTimer class.
virtual void expire(Event *e)
Method call when the timer expire.
virtual ~ProbeTimer()
Destructor of ProbeTimer class.
Class that describes the timer in the AUV.
virtual ~Uwpolling_AUV_Timer()
Destructor of the Uwpolling_AUV_Timer class.
Uwpolling_AUV_Timer(Uwpolling_AUV *m)
Constructor of the Uwpolling_AUV_Timer class.
virtual void freeze()
Freeze the timer.
Uwpolling_AUV *UWPOLLING_TIMER_STATUS timer_status
< Pointer to an object of type Uwpolling_AUV
bool isExpired()
Checks if the timer is EXPIRED.
int counter
counter of the timer
bool isActive()
Checks if the timer is ACTIVE.
void resetCounter()
Resets the counter of the timer.
virtual void schedule(double val)
Schedules a timer.
int getCounter()
Returns the counter of the timer.
double getDuration()
Returns the left duration of the timer.
virtual void stop()
stops the timer
bool isRunning()
Checks if the timer is RUNNING.
double start_time
Start Time of the timer.
bool isIdle()
Checks if the timer is IDLE.
bool isFrozen()
Checks if the timer is FROZEN.
double left_duration
Left duration of the timer.
virtual void unFreeze()
unFreeze is used to resume the timer starting from the point where it was freezed
void incrCounter()
Increments the counter of the timer.
Class used to represent the UWPOLLING MAC layer of the AUV.
std::deque< Packet * > tx_buffer
Queue of DATA in number of packets.
virtual void initInfo()
Prints a file with every state change for debug purposes.
virtual void Phy2MacStartRx(const Packet *p)
Method called when the Phy Layer start to receive a Packet.
PollTimer poll_timer
POLL Timer.
virtual void refreshState(UWPOLLING_AUV_STATUS state)
Refresh the state of the protocol.
Packet * curr_data_packet
Pointer to the current DATA packet.
int n_dropped_ack_pkts
Number of ACK dropped pkts.
virtual void ChangeNodePolled()
The first element of the list of nodes is trimmed and the next node is polled.
Packet * curr_tx_data_packet
Pointer to the current DATA packet.
Packet * curr_probe_packet
Pointer to the current PROBE packet.
probbed_node probbed_sink
Element with sink probe data.
void incrPollTx()
Incrase the number of POLL transmitted.
virtual uint16_t getPollTime()
Estimate the time needed by the AUV to POLL all the remaining node in the probbed node list.
int N_dropped_probe_pkts
Number of PROBE dropped because of CRC error.
int full_knowledge
Set to a number != 0 means we have full_knowledge about the estimate of neighbors.
void incrTriggerTx()
Increases the number of TRIGGER packets sent.
std::vector< probbed_node > list_probbed_node
list of nodes that have sent correctly the PROBE
virtual void handleNoAck()
Handle case with no ack received.
double Ttrigger
Time needed to transmit a TRIGGER packet.
virtual void Mac2PhyStartTx(Packet *p)
Pass the packet to the PHY layer.
int modem_data_bit_rate
Bit rate of the modem used.
UWPOLLING_AUV_STATUS prev_state
Current and previous state variable.
virtual void TxTrigger()
Transmission of the TRIGGER packet.
uint n_tx_pkts
Number of packets transmitted by the AUV during a TxData session.
virtual void stop_count_time()
Informs the protocol to stop counting the time in which the AUV receive DATA packets from the nodes I...
std::string backoff_LUT_file
File name of the backoff LUT.
virtual void stateIdle()
IDLE state.
virtual void waitForUser()
Used for debug purposes.
uint POLL_uid
POLL Unique ID.
uint TRIGGER_uid
TRIGGER Unique ID.
double Tdata
Time needed to transmit a DATA packet.
static std::map< UWPOLLING_AUV_REASON, std::string > reason_info
Map the UWPOLLING_AUV_STATUS to the description of each state.
@ UWPOLLING_AUV_REASON_PACKET_ERROR
@ UWPOLLING_AUV_REASON_RX_DATA_TO
@ UWPOLLING_AUV_REASON_PROBE_TO_EXPIRED
@ UWPOLLING_AUV_REASON_PROBE_RECEIVED
@ UWPOLLING_AUV_REASON_MAX_PROBE_RECEIVED
@ UWPOLLING_AUV_REASON_LAST_POLLED_NODE
@ UWPOLLING_AUV_REASON_LAST_PACKET_RECEIVED
@ UWPOLLING_AUV_REASON_TX_TRIGGER
virtual void SortNode2Poll()
Method in which the node that has sent correctly the PROBE packet is sorted in order to give the prio...
uint n_probe_rx
Number of PROBE packets received.
virtual void stateRxProbe()
State of the protocol in which there's a reception of a PROBE packet.
double curr_Tmeasured
Time elapsed between the transmission of the TRIGGER and the reception of the PROBE packet by the pol...
AckTimer ack_timer
ACK Timer.
int sea_trial_
Sea Trial flag: To activate if the protocol is going to be tested at the sea.
virtual void DataTOExpired()
DATA TIMER is Expired.
static bool initialized
Map the UWPOLLING_AUV_REASON to the description of each reason.
double T_probe
Duration of PROBE TIMER.
virtual double linearInterpolator(double x, double x1, double x2, double y1, double y2)
Calculate the linear interpolation between two 2-D points.
double total_time
Total time in which the AUV has received data packets.
Packet * curr_ack_packet
Pointer to the current ACK packet.
UWPOLLING_AUV_REASON reason
int getDroppedProbeWrongState()
Return the number of PROBE packets discarded because sent after the maximum time allowed.
void incrDroppedAckPkts()
Increases the number of wrong ACK packet received.
virtual void UpdateRTT()
Update the RTT between a node and the AUV based on the time elapsed between the transmisison of the T...
int getProbeRx()
Returns the number of PROBE received during the simulation.
int getWrongNodeDataSent()
Returns the number of Data Packet sent by Nodes not polled (used for debug purposes)
int DATA_POLL_guard_time_
Guard time between the reception of the last data and the transmission of the following POLL.
uint max_buffer_size
Temp buffer where packets are insert waiting for an ACK.
double T_guard
Guard time added to the calculation of the RTT.
int getPollSent()
Return the number of POLL packets sent during the simulation.
uint16_t uid_tx_pkt
Unique ID of the transmitted packets.
uint curr_node_id
ID of the node polled.
uint n_pkts_to_tx
Number of packets to transmit during a TxData session.
virtual void computeTxTime(UWPOLLING_PKT_TYPE pkt)
Compute the Transmission Time for various type of packet using a CrossLayer Message to ask the PHY to...
virtual void Phy2MacEndRx(Packet *p)
Method called when the Phy Layer finish to receive a Packet.
virtual void stateTxData()
Handle the data transmission after poll reception.
int max_polled_node
Maximum number of node that the AUV can poll each time.
int ack_enabled
True if ack is enabled, false if disabled, default true.
bool curr_is_sink
True if the current node of the list is a sink.
virtual void ackTOExpired()
ACK TIMER is Expired.
void incrDroppedProbePkts()
Increases the number of wrong PROBE packet received.
bool RxProbeEnabled
true if the AUV is enabled to receive PROBE packets, false otherwise
double probe_rtt
RTT calculation between AUV and NODE based on the time of PROBE transmission and reception.
double Tpoll
Time needed to transmit a POLL packet.
double T_max
Maximum value in which the node can choose his backoff time.
bool enableAckRx
True if the ack reception is enabled.
int getTriggerTx()
Returns the number of TRIGGER sent during the simulation.
static std::map< UWPOLLING_PKT_TYPE, std::string > pkt_type_info
Map the UWPOLLING_PKT_TYPE to the description of each type of packet.
double T_min
Minimum value in which the node can choose his backoff time.
ProbeTimer probe_timer
PROBE Timer.
virtual void refreshReason(UWPOLLING_AUV_REASON reason)
Refresh the reason for the changing of the state.
std::map< int, uint > rx_pkts_map
Map (mac_addr,rx_pkts) with the received packets for each node.
int print_stats_
Print protocol's statistics of the protocol.
void incrWrongNodeDataSent()
Increases the number of DATA packets received from node that are not POLLED anymore (i....
std::ofstream fout
Variable that handle the file in which the protocol write the state transition for debug purposes.
static std::map< UWPOLLING_AUV_STATUS, std::string > status_info
probe_cicle_counters probe_counters
Number of probe detected in a round (i.e., prehamble received)
virtual void handleAck()
Handle a received ack, reinserting in the buffer the packet not received by the sink.
virtual void addNode2List()
Add a node to the list of probbed nodes.
virtual void stateWaitData()
State of the protocol in which the DATA timer is set up.
virtual void stateTxPoll()
State of the protocol in which a POLL packet is initialized.
virtual void stateWaitAck()
State of the protcol in which the ACK timer is set up.
void incrAckRx()
Increases the number of Ack packets received.
UWPOLLING_AUV_REASON last_reason
Current and previous reason for the change of the state.
void incrDroppedProbeWrongState()
Increase the number of PROBEs packets dropped because the AUV was not in the RX_PROBE state.
int n_trigger_tx
Number of TRIGGER packets sent.
virtual void stateTxTrigger()
State of the protocol in which a TRIGGER packet is initialized.
virtual void handleProbeAck()
Handle the ack received in the probe packet tx by the sink.
int N_dropped_probe_wrong_state
Number of PROBE dropped because the AUV was not in RX_PROBE mode.
int getDroppedProbePkts()
Return the number of PROBE packets discarded because of wrong CRC.
virtual uint getRxPkts(int mac_addr)
Get the packets received from the node with the given mac address.
double pkt_time
Time needed to transmit a data packet.
Packet * curr_trigger_packet
true if the sink has been inserted in the list
bool RxDataEnabled
true if the AUV is enabled to receive DATA packets, false otherwise
virtual void stateAckRx()
Handle the recption of an ACK from the sink.
void incrProbeRx()
Increases the number of PROBE packets received.
uint16_t last_pkt_uid
ID of the last packet transmitted in the round.
DataTimer data_timer
Data timer.
virtual void recvFromUpperLayers(Packet *p)
Handle a packet coming from upper layers.
double stop_time
Time stamp in which the AUV finish to receive data packets.
uint max_tx_pkts
Max number of packets can be transmitted by the AUV during a TxData session.
double distance
Distance between the AUV and the current node.
double T_probe_guard
Guard time for PROBE packet: T_probe=T_max+T_probe_guard.
int getAckRx()
Returns the number of ACK received during the simulation.
std::ofstream out_file_stats
Variable that handle the file in which the protocol write the statistics.
virtual void addSink2List()
Add a sink node to the list of probbed nodes.
UWPOLLING_AUV_STATUS curr_state
int max_payload
Duration of ACK_TIMER.
std::deque< Packet * > temp_buffer
double Tprobe
Time needed to transmit a PROBE packet.
int N_expected_pkt
Number of packets that the node polled wish to transmit to the AUV.
double initial_time
Timestamp in which the AUV receive the first data packet.
virtual void TxPoll()
Transmisssion of the POLL packet.
virtual void stateWaitProbe()
State of the protocol in which the PROBE timer is set up.
std::map< double, double > backoff_LUT
Map with the backoff LUT.
int packet_index
Variable that indicate the number of the packet that has been just received by the AUV.
virtual ~Uwpolling_AUV()
Destructor of the Uwpolling_AUV class.
virtual void ProbeTOExpired()
PROBE TIMER is Expired.
double GetTotalReceivingTime()
Permits to retrieve the total time in which the AUV has received DATA packets.
virtual double GetDataTimerValue()
Calculation of DATA TIMER value based on the number of packet that a node need to transmit,...
virtual void Phy2MacEndTx(const Packet *p)
Method called when the PHY layer finish to transmit the packet.
bool initBackoffLUT()
Initialize the backoff LUT.
bool acked
True if an ack has been received.
virtual void txData()
Transmit data transmission after poll reception.
int n_poll_tx
Number of POLL packets sent.
int curr_polled_node_address
MAC address of the node polled.
UWPOLLING_AUV_STATUS
< Variable that rapresent the status of the protocol machine state
@ UWPOLLING_AUV_STATUS_WAIT_ACK
@ UWPOLLING_AUV_STATUS_TX_TRIGGER
@ UWPOLLING_AUV_STATUS_RX_PROBES
@ UWPOLLING_AUV_STATUS_WAIT_DATA
@ UWPOLLING_AUV_STATUS_WAIT_PROBE
Uwpolling_AUV()
Constructor of the Uwpolling_AUV class.
virtual int crLayCommand(ClMessage *m)
Cross-Layer messages interpreter.
int wrong_node_data_sent
Number of data sent by a node that isn't polled anymore.
unsigned long int getEpoch()
Calculate the epoch of the event.
int polling_index
Index of the node that the AUV is polling.
bool TxEnabled
true if the AUV is enabled to receive POLL packets, false otherwise
int getDroppedAckPkts()
Return the number of PROBE packets discarded because of wrong CRC.
int n_ack_rx
Number of ack packets received.
virtual void stateTx()
Handle the transmission after poll reception.
bool enable_adaptive_backoff
Set to true if backoff is chosen adaptively.
char lut_token_separator
LUT token separator.
bool begin
indicate the first PROBE received
virtual void stateRxData()
State of the protocol in which there's a reception of a DATA packet.
Packet * curr_poll_packet
Pointer to the current POLL packet.
virtual int command(int argc, const char *const *argv)
TCL command interpreter.
double curr_RTT
Round Trip time of the node polled.
double getMaxBackoffTime()
Reference to the backoff_time variable.
Internal structure where the AUV store the informations about the node to POLL.
uint16_t & get_id_ack()
Reference to the id_ack variable.
bool & is_sink()
Reference to the is_sink variable.
int n_pkts
Number of packets that the node transmit when he's polled.
double time_stamp
Timestamp of the most recent data packet generated by the node.
double & get_time_stamp()
Reference to the time_stamp variable.
uint id_node
Id of the node.
int & get_n_pkts()
Reference to the n_pkts variable.
double Tmeasured
Time elapsed between the transmisssion of the TRIGGER and the reception of the PROBE.
uint & get_id_node()
Reference to the id_node variable.
double & get_weight()
Reference to the policy_weight variable.
bool is_sink_
Ture if the probe comes from a sink.
uint16_t id_ack
Id used for ack purpose is the proebbed node is a sink.
int & get_mac_address()
Reference to the mac_address variable.
double policy_weight
Weigth used to choose the order to poll the nodes.
int mac_address
Mac Address of the node.
Struct used for handling the number of probes detected and received to estimate the number of neighbo...
uint n_probe_received
Number of probe received in a round (i.e., prehamble received)
uint n_probe_detected
Number of probe (prehamble) detected in a round by the MAC.
void incrementCounters()
Increment both counters.
void resetCounters()
Reset both counters.
uint getNumberOfNeighbors()
Get estimate number of neighbors.
std::pair< int, int > counter
counter of collisions
struct probbed_node probbed_node
Internal structure where the AUV store the informations about the node to POLL.
Common structures and variables in the protocol.
Provides the definition of the class UWSMPosition.