#include <uwflooding-sec.h>
This class defines the timer used to check the packet forwarding by the neighbor and handle reputation.
Definition at line 79 of file uwflooding-sec.h.
◆ NeighborReputationHandler()
NeighborReputationHandler::NeighborReputationHandler |
( |
uint8_t |
neigh_addr, |
|
|
UwFloodingSec * |
m, |
|
|
double |
alpha_val, |
|
|
int |
dbg |
|
) |
| |
Class constructor.
- Parameters
-
neigh_addr | address of the neighbor |
m | pointer to the UwFloding module |
alpha_val | paramer to be used to combine new and old snr values |
dbg | debug variable |
Definition at line 83 of file uwflooding-sec.cpp.
◆ ~NeighborReputationHandler()
NeighborReputationHandler::~NeighborReputationHandler |
( |
| ) |
|
|
virtual |
◆ addUnconfirmedPkt()
bool NeighborReputationHandler::addUnconfirmedPkt |
( |
int |
uid, |
|
|
double |
expire_time |
|
) |
| |
Add in the map the unconfirmed packets with the corresponidg timeout.
- Parameters
-
uid | unique id of the analyzed packet |
expire_time | expire time for the forwarding of neighbor |
- Returns
- true if the packet is correctly inserted, false oterwhise
Definition at line 104 of file uwflooding-sec.cpp.
◆ checkUnconfirmedPkt()
bool NeighborReputationHandler::checkUnconfirmedPkt |
( |
int |
uid | ) |
|
Check if the packet with the given uid is an unconfirmed one and set it as confirmed.
- Parameters
-
uid | unique id if the analyzed packet |
- Returns
- true if the packet is present, false otherwise
Definition at line 136 of file uwflooding-sec.cpp.
◆ expire()
void NeighborReputationHandler::expire |
( |
Event * |
e | ) |
|
|
protectedvirtual |
Method called when the timer expire.
- Parameters
-
Event* | pointer to an object of type Event |
Definition at line 177 of file uwflooding-sec.cpp.
◆ getNextPacket()
bool NeighborReputationHandler::getNextPacket |
( |
int & |
uid, |
|
|
double & |
exp_time |
|
) |
| const |
|
protected |
Returns as reference the uid of the next packet that id going to expire.
Returns false if there are no packets in the map.
- Parameters
-
uid | unique id of the next packet that is going to expire. |
exp_time | expire time of the next packet that is going to expire. |
- Returns
- false if there is no packets in the map, true otherwise.
Definition at line 217 of file uwflooding-sec.cpp.
◆ removeOldPackets()
void NeighborReputationHandler::removeOldPackets |
( |
| ) |
|
|
protected |
◆ updateChannelMetrics()
void NeighborReputationHandler::updateChannelMetrics |
( |
double |
val_snr, |
|
|
double |
last_noise_val |
|
) |
| |
Update average SNR.
- Parameters
-
val_snr | new SNR value |
last_noise_val | value of the noise for the last received packet |
Definition at line 262 of file uwflooding-sec.cpp.
◆ updateInstantNoise()
void NeighborReputationHandler::updateInstantNoise |
( |
double |
inst_noise_val | ) |
|
Update the value of the instantaneous noise.
- Parameters
-
inst_noise_val | value of the instantaneous noise |
Definition at line 281 of file uwflooding-sec.cpp.
◆ alpha
double NeighborReputationHandler::alpha |
|
protected |
◆ avg_snr
double NeighborReputationHandler::avg_snr |
|
protected |
Uid of the packet that should be forwarded.
Average SNR of the last received packets.
Definition at line 156 of file uwflooding-sec.h.
◆ debug
int NeighborReputationHandler::debug |
|
protected |
◆ inst_noise
double NeighborReputationHandler::inst_noise |
|
protected |
◆ is_first_pkt
bool NeighborReputationHandler::is_first_pkt |
|
protected |
◆ is_running
bool NeighborReputationHandler::is_running |
|
protected |
True if a timer has been already scheduled and not expired yet.
Definition at line 153 of file uwflooding-sec.h.
◆ last_noise
double NeighborReputationHandler::last_noise |
|
protected |
Boolean variable to check if the packet is the first received one or not.
Used to correctly averaged snr. Noise power of the last correctly received packet.
Definition at line 160 of file uwflooding-sec.h.
◆ neighbor_addr
< Pointer to the uwflooding module.
Address of the considered neighbor.
Definition at line 150 of file uwflooding-sec.h.
◆ unconfirmed_pkts
std::map<int, double> NeighborReputationHandler::unconfirmed_pkts |
|
protected |
Map with the uid of the unconfirmed packets, with the corresponding forwarding timeout.
Definition at line 151 of file uwflooding-sec.h.
◆ waiting_uid
int NeighborReputationHandler::waiting_uid |
|
protected |
The documentation for this class was generated from the following files: