|
DESERT 4.0.0
|
#include <uwflooding-sec.h>


Public Member Functions | |
| NeighborReputationHandler (uint8_t neigh_addr, UwFloodingSec *m, double alpha_val, int dbg) | |
| virtual | ~NeighborReputationHandler () |
| bool | addUnconfirmedPkt (int uid, double expire_time) |
| bool | checkUnconfirmedPkt (int uid) |
| void | updateChannelMetrics (double val_snr, double last_noise_val) |
| void | updateInstantNoise (double inst_noise_val) |
Protected Member Functions | |
| bool | getNextPacket (int &uid, double &exp_time) const |
| void | removeOldPackets () |
| virtual void | expire (Event *e) |
Protected Attributes | |
| UwFloodingSec *uint8_t | neighbor_addr |
| std::map< int, double > | unconfirmed_pkts |
| bool | is_running |
| int | waiting_uid |
| double | avg_snr |
| double | alpha |
| bool | is_first_pkt |
| double | last_noise |
| double | inst_noise |
| int | debug |
This class defines the timer used to check the packet forwarding by the neighbor and handle reputation
| NeighborReputationHandler::NeighborReputationHandler | ( | uint8_t | neigh_addr, |
| UwFloodingSec * | m, | ||
| double | alpha_val, | ||
| int | dbg | ||
| ) |
Class constructor
| 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 |
|
virtual |
Class destructor
| bool NeighborReputationHandler::addUnconfirmedPkt | ( | int | uid, |
| double | expire_time | ||
| ) |
Add in the map the unconfirmed packets with the corresponidg timeout
| uid | unique id of the analyzed packet |
| expire_time | expire time for the forwarding of neighbor |
References debug, UwFloodingSec::ipAddr_, is_running, neighbor_addr, unconfirmed_pkts, and waiting_uid.
| bool NeighborReputationHandler::checkUnconfirmedPkt | ( | int | uid | ) |
Check if the packet with the given uid is an unconfirmed one and set it as confirmed
| uid | unique id if the analyzed packet |
References avg_snr, debug, getNextPacket(), inst_noise, is_running, last_noise, neighbor_addr, unconfirmed_pkts, and waiting_uid.

|
protectedvirtual |
Method called when the timer expire
| Event* | pointer to an object of type Event |
References avg_snr, debug, getNextPacket(), inst_noise, UwFloodingSec::ipAddr_, is_running, last_noise, neighbor_addr, removeOldPackets(), unconfirmed_pkts, and waiting_uid.

|
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.
| 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. |
References unconfirmed_pkts.
Referenced by checkUnconfirmedPkt(), and expire().
|
protected |
Removes packet with an old expire time.
References avg_snr, debug, inst_noise, UwFloodingSec::ipAddr_, last_noise, neighbor_addr, and unconfirmed_pkts.
Referenced by expire().
| void NeighborReputationHandler::updateChannelMetrics | ( | double | val_snr, |
| double | last_noise_val | ||
| ) |
Update average SNR
| val_snr | new SNR value |
| last_noise_val | value of the noise for the last received packet |
References alpha, avg_snr, debug, inst_noise, is_first_pkt, last_noise, and neighbor_addr.
| void NeighborReputationHandler::updateInstantNoise | ( | double | inst_noise_val | ) |
Update the value of the instantaneous noise
| inst_noise_val | value of the instantaneous noise |
References debug, inst_noise, UwFloodingSec::ipAddr_, last_noise, and neighbor_addr.
|
protected |
weight for the new SNR value.
Referenced by updateChannelMetrics().
|
protected |
Uid of the packet that should be forwarded. Average SNR of the last received packets.
Referenced by checkUnconfirmedPkt(), expire(), removeOldPackets(), and updateChannelMetrics().
|
protected |
Referenced by addUnconfirmedPkt(), checkUnconfirmedPkt(), expire(), removeOldPackets(), updateChannelMetrics(), and updateInstantNoise().
|
protected |
Instantaneous noise level.
Referenced by checkUnconfirmedPkt(), expire(), removeOldPackets(), updateChannelMetrics(), and updateInstantNoise().
|
protected |
Referenced by updateChannelMetrics().
|
protected |
True if a timer has been already scheduled and not expired yet.
Referenced by addUnconfirmedPkt(), checkUnconfirmedPkt(), and expire().
|
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.
Referenced by checkUnconfirmedPkt(), expire(), removeOldPackets(), updateChannelMetrics(), and updateInstantNoise().
|
protected |
< Pointer to the uwflooding module. Address of the considered neighbor.
Referenced by addUnconfirmedPkt(), checkUnconfirmedPkt(), expire(), removeOldPackets(), updateChannelMetrics(), and updateInstantNoise().
|
protected |
Map with the uid of the unconfirmed packets, with the corresponding forwarding timeout.
Referenced by addUnconfirmedPkt(), checkUnconfirmedPkt(), expire(), getNextPacket(), and removeOldPackets().
|
protected |
Referenced by addUnconfirmedPkt(), checkUnconfirmedPkt(), and expire().