|
@@ -289,18 +289,29 @@ struct ipAddress_inOut_port {
|
|
|
* - Destination MAC address
|
|
|
* - Payload type number
|
|
|
*/
|
|
|
-struct untracked_PDU {
|
|
|
+struct unrecognized_PDU {
|
|
|
std::string srcMacAddress;
|
|
|
std::string dstMacAddress;
|
|
|
uint32_t typeNumber;
|
|
|
|
|
|
- bool operator==(const untracked_PDU &other) const {
|
|
|
+ bool operator==(const unrecognized_PDU &other) const {
|
|
|
return srcMacAddress == other.srcMacAddress
|
|
|
&& dstMacAddress == other.dstMacAddress
|
|
|
&& typeNumber == other.typeNumber;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+/*
|
|
|
+ * Struct used to represent:
|
|
|
+ * - Number of occurrences
|
|
|
+ * - Formatted timestamp of last occurrence
|
|
|
+ */
|
|
|
+struct unrecognized_PDU_stat {
|
|
|
+ int count;
|
|
|
+ std::string timestamp_last_occurrence;
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
/*
|
|
|
* Definition of hash functions for structs used as key in unordered_map
|
|
|
*/
|
|
@@ -386,8 +397,8 @@ namespace std {
|
|
|
};
|
|
|
|
|
|
template<>
|
|
|
- struct hash<untracked_PDU> {
|
|
|
- std::size_t operator()(const untracked_PDU &k) const {
|
|
|
+ struct hash<unrecognized_PDU> {
|
|
|
+ std::size_t operator()(const unrecognized_PDU &k) const {
|
|
|
using std::size_t;
|
|
|
using std::hash;
|
|
|
using std::string;
|
|
@@ -443,7 +454,8 @@ public:
|
|
|
|
|
|
void increaseProtocolByteCount(std::string ipAddress, std::string protocol, long bytesSent);
|
|
|
|
|
|
- void incrementUntrackedPDUCount(std::string srcMac, std::string dstMac, uint32_t typeNumber);
|
|
|
+ void incrementUnrecognizedPDUCount(std::string srcMac, std::string dstMac, uint32_t typeNumber,
|
|
|
+ std::string timestamp);
|
|
|
|
|
|
void incrementPortCount(std::string ipAddressSender, int outgoingPort, std::string ipAddressReceiver,
|
|
|
int incomingPort);
|
|
@@ -578,8 +590,8 @@ 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;
|
|
|
+ // {Source MAC, Destination MAC, typeNumber, #count, #timestamp of last occurrence}
|
|
|
+ std::unordered_map<unrecognized_PDU, unrecognized_PDU_stat> unrecognized_PDUs;
|
|
|
};
|
|
|
|
|
|
|