|
@@ -283,6 +283,24 @@ struct ipAddress_inOut_port {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * Struct used to represent:
|
|
|
|
+ * - Source MAC address
|
|
|
|
+ * - Destination MAC address
|
|
|
|
+ * - Payload type number
|
|
|
|
+ */
|
|
|
|
+struct untracked_PDU {
|
|
|
|
+ std::string srcMacAddress;
|
|
|
|
+ std::string dstMacAddress;
|
|
|
|
+ uint32_t typeNumber;
|
|
|
|
+
|
|
|
|
+ bool operator==(const untracked_PDU &other) const {
|
|
|
|
+ return srcMacAddress == other.srcMacAddress
|
|
|
|
+ && dstMacAddress == other.dstMacAddress
|
|
|
|
+ && typeNumber == other.typeNumber;
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* Definition of hash functions for structs used as key in unordered_map
|
|
* Definition of hash functions for structs used as key in unordered_map
|
|
*/
|
|
*/
|
|
@@ -366,6 +384,18 @@ namespace std {
|
|
^ (hash<int>()(k.portNumber) << 1);
|
|
^ (hash<int>()(k.portNumber) << 1);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+ template<>
|
|
|
|
+ struct hash<untracked_PDU> {
|
|
|
|
+ std::size_t operator()(const untracked_PDU &k) const {
|
|
|
|
+ using std::size_t;
|
|
|
|
+ using std::hash;
|
|
|
|
+ using std::string;
|
|
|
|
+ return ((hash<string>()(k.srcMacAddress)
|
|
|
|
+ ^ (hash<string>()(k.dstMacAddress) << 1)) >> 1)
|
|
|
|
+ ^ (hash<uint32_t>()(k.typeNumber) << 1);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
}
|
|
}
|
|
|
|
|
|
class statistics {
|
|
class statistics {
|
|
@@ -413,6 +443,8 @@ public:
|
|
|
|
|
|
void increaseProtocolByteCount(std::string ipAddress, std::string protocol, long bytesSent);
|
|
void increaseProtocolByteCount(std::string ipAddress, std::string protocol, long bytesSent);
|
|
|
|
|
|
|
|
+ void incrementUntrackedPDUCount(std::string srcMac, std::string dstMac, uint32_t typeNumber);
|
|
|
|
+
|
|
void incrementPortCount(std::string ipAddressSender, int outgoingPort, std::string ipAddressReceiver,
|
|
void incrementPortCount(std::string ipAddressSender, int outgoingPort, std::string ipAddressReceiver,
|
|
int incomingPort);
|
|
int incomingPort);
|
|
|
|
|
|
@@ -545,6 +577,9 @@ private:
|
|
|
|
|
|
// {IP Address, MAC Address}
|
|
// {IP Address, MAC Address}
|
|
std::unordered_map<std::string, std::string> ip_mac_mapping;
|
|
std::unordered_map<std::string, std::string> ip_mac_mapping;
|
|
|
|
+
|
|
|
|
+ // {Source MAC, Destination MAC, typeNumber, #count}
|
|
|
|
+ std::unordered_map<untracked_PDU, int> untracked_PDUs;
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|