|
PcapPlusPlus
20.08
|
Go to the documentation of this file. 1 #ifndef PACKETPP_IP_REASSEMBLY
2 #define PACKETPP_IP_REASSEMBLY
50 #define PCPP_IP_REASSEMBLY_DEFAULT_MAX_PACKETS_TO_STORE 500000
101 PacketKey(
const PacketKey& other);
138 m_IpID = other.m_IpID;
139 m_SrcIP = other.m_SrcIP;
140 m_DstIP = other.m_DstIP;
163 void setIpID(uint16_t ipID) { m_IpID = ipID; }
230 m_FragmentID = other.m_FragmentID;
231 m_SrcIP = other.m_SrcIP;
232 m_SrcIP = other.m_DstIP;
282 uint32_t m_FragmentID;
328 : m_PacketLRU(maxPacketsToStore), m_OnFragmentsCleanCallback(onFragmentsCleanCallback), m_CallbackUserCookie(callbackUserCookie) {}
426 uint16_t fragmentOffset;
428 uint8_t* fragmentData;
429 size_t fragmentDataLen;
430 IPFragment() { fragmentOffset = 0; lastFragment =
false; fragmentData = NULL; fragmentDataLen = 0; }
431 ~IPFragment() {
delete [] fragmentData; }
434 struct IPFragmentData
436 uint16_t currentOffset;
440 PacketKey* packetKey;
441 PointerVector<IPFragment> outOfOrderFragments;
442 IPFragmentData(PacketKey* pktKey, uint32_t fragId) { currentOffset = 0; data = NULL; deleteData =
true; fragmentID = fragId; packetKey = pktKey; }
443 ~IPFragmentData() {
delete packetKey;
if (deleteData && data != NULL) {
delete data; } }
446 LRUList<uint32_t> m_PacketLRU;
447 std::map<uint32_t, IPFragmentData*> m_FragmentMap;
449 void* m_CallbackUserCookie;
451 void addNewFragment(uint32_t hash, IPFragmentData* fragData);
452 bool matchOutOfOrderFragments(IPFragmentData* fragData);
457 #endif // PACKETPP_IP_REASSEMBLY
void setSrcIP(const IPv6Address &srcIP)
Definition: IPReassembly.h:261
OsiModelLayer
Definition: ProtocolType.h:233
Definition: IpAddress.h:26
Definition: IpAddress.h:140
Definition: IPReassembly.h:201
Packet * processPacket(Packet *fragment, ReassemblyStatus &status, ProtocolType parseUntil=UnknownProtocol, OsiModelLayer parseUntilLayer=OsiModelLayerUnknown)
uint32_t getFragmentID() const
Definition: IPReassembly.h:239
@ NON_FRAGMENT
Definition: IPReassembly.h:306
@ MALFORMED_FRAGMENT
Definition: IPReassembly.h:314
void removePacket(const PacketKey &key)
PacketKey * clone() const
Definition: IPReassembly.h:279
Definition: IPReassembly.h:109
size_t getCurrentCapacity() const
Definition: IPReassembly.h:420
@ OUT_OF_ORDER_FRAGMENT
Definition: IPReassembly.h:312
size_t getMaxSize() const
Definition: LRUList.h:120
void(* OnFragmentsClean)(const PacketKey *key, void *userCookie)
Definition: IPReassembly.h:296
PacketKey * clone() const
Definition: IPReassembly.h:187
IPv4PacketKey(const IPv4PacketKey &other)
Definition: IPReassembly.h:130
Definition: IPReassembly.h:72
IPv4PacketKey(uint16_t ipid, IPv4Address srcip, IPv4Address dstip)
Definition: IPReassembly.h:124
virtual ProtocolType getProtocolType() const =0
void setIpID(uint16_t ipID)
Definition: IPReassembly.h:163
virtual uint32_t getHashValue() const =0
IPv4PacketKey & operator=(const IPv4PacketKey &other)
Definition: IPReassembly.h:136
ProtocolType getProtocolType() const
Definition: IPReassembly.h:277
@ FIRST_FRAGMENT
Definition: IPReassembly.h:308
uint64_t ProtocolType
Definition: ProtocolType.h:18
IPv6PacketKey(const IPv6PacketKey &other)
Definition: IPReassembly.h:222
@ OsiModelLayerUnknown
Definition: ProtocolType.h:250
uint16_t getIpID() const
Definition: IPReassembly.h:147
IPv6PacketKey(uint32_t fragmentID, IPv6Address srcip, IPv6Address dstip)
Definition: IPReassembly.h:216
const ProtocolType UnknownProtocol
Definition: ProtocolType.h:23
IPv6PacketKey()
Definition: IPReassembly.h:208
void setDstIP(const IPv4Address &dstIP)
Definition: IPReassembly.h:175
uint32_t getHashValue() const
virtual PacketKey * clone() const =0
ReassemblyStatus
Definition: IPReassembly.h:301
uint32_t getHashValue() const
IPv4Address getDstIP() const
Definition: IPReassembly.h:157
The main namespace for the PcapPlusPlus lib.
ProtocolType getProtocolType() const
Definition: IPReassembly.h:185
@ REASSEMBLED
Definition: IPReassembly.h:316
#define PCPP_IP_REASSEMBLY_DEFAULT_MAX_PACKETS_TO_STORE
Definition: IPReassembly.h:50
IPv4PacketKey()
Definition: IPReassembly.h:116
const ProtocolType IPv4
Definition: ProtocolType.h:33
void setDstIP(const IPv6Address &dstIP)
Definition: IPReassembly.h:267
const ProtocolType IPv6
Definition: ProtocolType.h:38
IPv6Address getSrcIP() const
Definition: IPReassembly.h:244
virtual ~PacketKey()
Definition: IPReassembly.h:79
size_t getMaxCapacity() const
Definition: IPReassembly.h:415
@ FRAGMENT
Definition: IPReassembly.h:310
IPv6Address getDstIP() const
Definition: IPReassembly.h:249
@ NON_IP_PACKET
Definition: IPReassembly.h:304
void setFragmentID(uint32_t fragID)
Definition: IPReassembly.h:255
IPReassembly(OnFragmentsClean onFragmentsCleanCallback=NULL, void *callbackUserCookie=NULL, size_t maxPacketsToStore=500000)
Definition: IPReassembly.h:327
Packet * getCurrentPacket(const PacketKey &key)
Definition: IPReassembly.h:63
Definition: RawPacket.h:252
IPv6PacketKey & operator=(const IPv6PacketKey &other)
Definition: IPReassembly.h:228
void setSrcIP(const IPv4Address &srcIP)
Definition: IPReassembly.h:169
IPv4Address getSrcIP() const
Definition: IPReassembly.h:152