7 #include <unordered_map>
53 #define PCPP_IP_REASSEMBLY_DEFAULT_MAX_PACKETS_TO_STORE 500000
128 : m_IpID(ipid), m_SrcIP(srcip), m_DstIP(dstip)
136 :
PacketKey(other), m_IpID(other.m_IpID), m_SrcIP(other.m_SrcIP), m_DstIP(other.m_DstIP)
145 m_IpID = other.m_IpID;
146 m_SrcIP = other.m_SrcIP;
147 m_DstIP = other.m_DstIP;
246 : m_FragmentID(fragmentID), m_SrcIP(srcip), m_DstIP(dstip)
254 :
PacketKey(other), m_FragmentID(other.m_FragmentID), m_SrcIP(other.m_SrcIP), m_DstIP(other.m_DstIP)
263 m_FragmentID = other.m_FragmentID;
264 m_SrcIP = other.m_SrcIP;
265 m_DstIP = other.m_DstIP;
299 m_FragmentID = fragID;
338 uint32_t m_FragmentID;
389 : m_PacketLRU(maxPacketsToStore), m_OnFragmentsCleanCallback(onFragmentsCleanCallback),
390 m_CallbackUserCookie(callbackUserCookie)
511 return m_FragmentMap.size();
517 uint16_t fragmentOffset;
519 uint8_t* fragmentData;
520 size_t fragmentDataLen;
524 lastFragment =
false;
525 fragmentData =
nullptr;
530 delete[] fragmentData;
534 struct IPFragmentData
536 uint16_t currentOffset;
540 PacketKey* packetKey;
541 PointerVector<IPFragment> outOfOrderFragments;
542 IPFragmentData(PacketKey* pktKey, uint32_t fragId)
553 if (deleteData && data !=
nullptr)
560 LRUList<uint32_t> m_PacketLRU;
561 std::unordered_map<uint32_t, IPFragmentData*> m_FragmentMap;
563 void* m_CallbackUserCookie;
565 void addNewFragment(uint32_t hash, IPFragmentData* fragData);
566 bool matchOutOfOrderFragments(IPFragmentData* fragData);
#define PCPP_IP_REASSEMBLY_DEFAULT_MAX_PACKETS_TO_STORE
Definition: IPReassembly.h:53
Definition: IPReassembly.h:113
PacketKey * clone() const
Definition: IPReassembly.h:214
void setDstIP(const IPv4Address &dstIP)
Definition: IPReassembly.h:197
IPv4PacketKey & operator=(const IPv4PacketKey &other)
Definition: IPReassembly.h:143
uint16_t getIpID() const
Definition: IPReassembly.h:154
ProtocolType getProtocolType() const
Definition: IPReassembly.h:209
void setSrcIP(const IPv4Address &srcIP)
Definition: IPReassembly.h:188
IPv4PacketKey(uint16_t ipid, IPv4Address srcip, IPv4Address dstip)
Definition: IPReassembly.h:127
uint32_t getHashValue() const
IPv4Address getSrcIP() const
Definition: IPReassembly.h:162
IPv4Address getDstIP() const
Definition: IPReassembly.h:170
IPv4PacketKey()
Definition: IPReassembly.h:118
void setIpID(uint16_t ipID)
Definition: IPReassembly.h:179
IPv4PacketKey(const IPv4PacketKey &other)
Definition: IPReassembly.h:135
Definition: IPReassembly.h:231
IPv6PacketKey()
Definition: IPReassembly.h:236
IPv6PacketKey(uint32_t fragmentID, IPv6Address srcip, IPv6Address dstip)
Definition: IPReassembly.h:245
void setFragmentID(uint32_t fragID)
Definition: IPReassembly.h:297
void setSrcIP(const IPv6Address &srcIP)
Definition: IPReassembly.h:306
uint32_t getFragmentID() const
Definition: IPReassembly.h:272
uint32_t getHashValue() const
IPv6PacketKey & operator=(const IPv6PacketKey &other)
Definition: IPReassembly.h:261
void setDstIP(const IPv6Address &dstIP)
Definition: IPReassembly.h:315
IPv6PacketKey(const IPv6PacketKey &other)
Definition: IPReassembly.h:253
ProtocolType getProtocolType() const
Definition: IPReassembly.h:327
IPv6Address getDstIP() const
Definition: IPReassembly.h:288
PacketKey * clone() const
Definition: IPReassembly.h:332
IPv6Address getSrcIP() const
Definition: IPReassembly.h:280
Definition: IPReassembly.h:77
virtual ~PacketKey()=default
virtual ProtocolType getProtocolType() const =0
virtual PacketKey * clone() const =0
virtual uint32_t getHashValue() const =0
Definition: IPReassembly.h:69
Packet * getCurrentPacket(const PacketKey &key)
size_t getMaxCapacity() const
Definition: IPReassembly.h:501
void removePacket(const PacketKey &key)
IPReassembly(OnFragmentsClean onFragmentsCleanCallback=nullptr, void *callbackUserCookie=nullptr, size_t maxPacketsToStore=500000)
Definition: IPReassembly.h:387
void(* OnFragmentsClean)(const PacketKey *key, void *userCookie)
Definition: IPReassembly.h:353
Packet * processPacket(Packet *fragment, ReassemblyStatus &status, ProtocolType parseUntil=UnknownProtocol, OsiModelLayer parseUntilLayer=OsiModelLayerUnknown)
Packet * processPacket(RawPacket *fragment, ReassemblyStatus &status, ProtocolType parseUntil=UnknownProtocol, OsiModelLayer parseUntilLayer=OsiModelLayerUnknown)
ReassemblyStatus
Definition: IPReassembly.h:359
@ FIRST_FRAGMENT
Definition: IPReassembly.h:365
@ FRAGMENT
Definition: IPReassembly.h:367
@ OUT_OF_ORDER_FRAGMENT
Definition: IPReassembly.h:369
@ REASSEMBLED
Definition: IPReassembly.h:374
@ MALFORMED_FRAGMENT
Definition: IPReassembly.h:372
@ NON_FRAGMENT
Definition: IPReassembly.h:363
@ NON_IP_PACKET
Definition: IPReassembly.h:361
size_t getCurrentCapacity() const
Definition: IPReassembly.h:509
Definition: IpAddress.h:32
Definition: IpAddress.h:199
size_t getMaxSize() const
Definition: LRUList.h:121
Definition: RawPacket.h:269
The main namespace for the PcapPlusPlus lib.
uint8_t ProtocolType
Definition: ProtocolType.h:17
OsiModelLayer
Definition: ProtocolType.h:354
@ OsiModelLayerUnknown
Definition: ProtocolType.h:370
const ProtocolType IPv4
Definition: ProtocolType.h:38
const ProtocolType IPv6
Definition: ProtocolType.h:43
const ProtocolType UnknownProtocol
Definition: ProtocolType.h:28