|
@@ -11,37 +11,6 @@
|
|
|
using namespace Tins;
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- * Checks if ToS is valid according to RFC2472 and increments counter.
|
|
|
- * @param uint8_t ToS value to be checked.
|
|
|
- */
|
|
|
-void statistics::checkToS(uint8_t ToS) {
|
|
|
- if(this->getDoTests()) {
|
|
|
-
|
|
|
- if((unsigned)ToS != 0) {
|
|
|
- std::bitset<8> tosBit(ToS);
|
|
|
-
|
|
|
- std::stringstream dscpStream;
|
|
|
- dscpStream <<tosBit[7]<<tosBit[6]<<tosBit[5]<<tosBit[4]<<tosBit[3]<<tosBit[2];
|
|
|
- std::bitset<6> dscpBit(dscpStream.str());
|
|
|
- int dscpInt = (int)(dscpBit.to_ulong());
|
|
|
-
|
|
|
-
|
|
|
- int validValues[] = {0,2,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,46,48,56};
|
|
|
- bool exists = std::find(std::begin(validValues), std::end(validValues), dscpInt) != std::end(validValues);
|
|
|
-
|
|
|
-
|
|
|
- if(!exists && tosBit[0] == 0)
|
|
|
- invalidToSCount++;
|
|
|
- else
|
|
|
- validToSCount++;
|
|
|
-
|
|
|
- dscp_distribution[dscpInt]++;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
|
|
|
* Checks if there is a payload and increments payloads counter.
|
|
@@ -197,8 +166,8 @@ void statistics::addIntervalStat(std::chrono::duration<int, std::micro> interval
|
|
|
|
|
|
calculateIPIntervalPacketRate(interval, intervalStartTimestamp);
|
|
|
|
|
|
- std::vector<float> ipEntopies = {0,0};
|
|
|
- std::vector<float> ipCumEntopies = {0,0};
|
|
|
+ std::vector<float> ipEntopies = calculateLastIntervalIPsEntropy(intervalStartTimestamp);
|
|
|
+ std::vector<float> ipCumEntopies = calculateIPsCumEntropy();
|
|
|
std::string lastPktTimestamp_s = std::to_string(intervalEndTimestamp.count());
|
|
|
std::string intervalStartTimestamp_s = std::to_string(intervalStartTimestamp.count());
|
|
|
|