|
@@ -285,6 +285,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
|
|
|
*/
|
|
@@ -368,6 +386,18 @@ namespace std {
|
|
|
^ (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 {
|
|
@@ -415,6 +445,8 @@ public:
|
|
|
|
|
|
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,
|
|
|
int incomingPort, std::string protocol);
|
|
|
|
|
@@ -547,6 +579,9 @@ private:
|
|
|
|
|
|
// {IP Address, MAC Address}
|
|
|
std::unordered_map<std::string, std::string> ip_mac_mapping;
|
|
|
+
|
|
|
+ // {Source MAC, Destination MAC, typeNumber, #count}
|
|
|
+ std::unordered_map<untracked_PDU, int> untracked_PDUs;
|
|
|
};
|
|
|
|
|
|
|