Skip to content

Commit

Permalink
AckingMacToEthernetPcapRecorderHelper: Followed recent PcapRecorder c…
Browse files Browse the repository at this point in the history
…hanges.
  • Loading branch information
levy committed Jan 6, 2025
1 parent 4aae98c commit 2d93f15
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/inet/linklayer/acking/AckingMacHeaderSerializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ PcapLinkType AckingMacToEthernetPcapRecorderHelper::protocolToLinkType(const Pro
return LINKTYPE_INVALID;
}

Packet *AckingMacToEthernetPcapRecorderHelper::tryConvertToLinkType(const Packet *packet, PcapLinkType pcapLinkType, const Protocol *protocol) const
Packet *AckingMacToEthernetPcapRecorderHelper::tryConvertToLinkType(const Packet *packet, b frontOffset, b backOffset, PcapLinkType pcapLinkType, const Protocol *protocol) const
{
#if defined(INET_WITH_ETHERNET)
if (*protocol == Protocol::ackingMac && pcapLinkType == LINKTYPE_ETHERNET) {
auto newPacket = packet->dup();
const auto& frontPart = frontOffset != b(0) ? newPacket->removeAtFront(frontOffset) : nullptr;
auto ackingHdr = newPacket->popAtFront<AckingMacHeader>();
newPacket->trimFront();
auto ethHeader = makeShared<EthernetMacHeader>();
Expand All @@ -79,6 +80,8 @@ Packet *AckingMacToEthernetPcapRecorderHelper::tryConvertToLinkType(const Packet
ethHeader->setTypeOrLength(ackingHdr->getNetworkProtocol());
newPacket->insertAtFront(ethHeader);
newPacket->addTagIfAbsent<PacketProtocolTag>()->setProtocol(&Protocol::ethernetMac);
if (frontPart != nullptr)
newPacket->insertAtFront(frontPart);
return newPacket;
}
#endif // defined(INET_WITH_ETHERNET)
Expand Down
2 changes: 1 addition & 1 deletion src/inet/linklayer/acking/AckingMacHeaderSerializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class INET_API AckingMacToEthernetPcapRecorderHelper : public cObject, public Pc
{
virtual PcapLinkType protocolToLinkType(const Protocol *protocol) const;
virtual bool matchesLinkType(PcapLinkType pcapLinkType, const Protocol *protocol) const;
virtual Packet *tryConvertToLinkType(const Packet *packet, PcapLinkType pcapLinkType, const Protocol *protocol) const;
virtual Packet *tryConvertToLinkType(const Packet *packet, b frontOffset, b backOffset, PcapLinkType pcapLinkType, const Protocol *protocol) const;
};

} // namespace inet
Expand Down

0 comments on commit 2d93f15

Please sign in to comment.