Skip to content

Commit

Permalink
NetworkCommunicationFingerprintCalculator: remove inet4 specific code
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoltanBojthe committed Aug 26, 2019
1 parent 60defdb commit 22731a3
Showing 1 changed file with 5 additions and 27 deletions.
32 changes: 5 additions & 27 deletions src/inet/common/NetworkCommunicationFingerprintCalculator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include "inet/common/ModuleAccess.h"
#include "inet/common/NetworkCommunicationFingerprintCalculator.h"
#include "inet/common/packet/Packet.h"

namespace inet {

Expand All @@ -42,28 +41,10 @@ bool NetworkCommunicationFingerprintCalculator::addEventIngredient(cEvent *event
hasher->add(senderNode->getFullPath().c_str());
hasher->add(arrivalNode->getFullPath().c_str());
break;
case NETWORK_INTERFACE_PATH:
if (auto senderInterface = findContainingNicModule(cpacket->getSenderModule()))
hasher->add(senderInterface->getInterfaceFullPath().c_str());
if (auto arrivalInterface = findContainingNicModule(cpacket->getArrivalModule()))
hasher->add(arrivalInterface->getInterfaceFullPath().c_str());
break;
case PACKET_DATA: {
auto packet = dynamic_cast<Packet *>(cpacket);
if (packet == nullptr)
packet = check_and_cast<Packet *>(cpacket->getEncapsulatedPacket());
if (packet->getTotalLength().get() % 8 == 0) {
const auto& content = packet->peekAllAsBytes();
for (auto byte : content->getBytes())
hasher->add(byte);
}
else {
const auto& content = packet->peekAllAsBits();
for (auto bit : content->getBits())
hasher->add(bit);
}
break;
}
// case NETWORK_INTERFACE_PATH:
// break;
// case PACKET_DATA:
// break;
default:
throw cRuntimeError("Unknown fingerprint ingredient '%c' (%d)", ingredient, ingredient);
}
Expand All @@ -75,10 +56,7 @@ void NetworkCommunicationFingerprintCalculator::addEvent(cEvent *event)
{
if (event->isMessage() && static_cast<cMessage *>(event)->isPacket()) {
auto cpacket = static_cast<cPacket *>(event);
auto packet = dynamic_cast<Packet *>(cpacket);
if (packet == nullptr)
packet = dynamic_cast<Packet *>(cpacket->getEncapsulatedPacket());
if (packet != nullptr) {
if (cpacket != nullptr) {
auto senderNode = findContainingNode(cpacket->getSenderModule());
auto arrivalNode = findContainingNode(cpacket->getArrivalModule());
if (senderNode != arrivalNode)
Expand Down

0 comments on commit 22731a3

Please sign in to comment.