1 #ifndef PACKETPP_TCP_REASSEMBLY 2 #define PACKETPP_TCP_REASSEMBLY 99 ConnectionData() : srcPort(0), dstPort(0), flowKey(0), startTime(), endTime() {}
135 : m_Data(tcpData), m_DataLen(tcpDataLength), m_MissingBytes(missingBytes), m_Connection(connData), m_Timestamp(timestamp)
143 const uint8_t*
getData()
const {
return m_Data; }
176 const uint8_t* m_Data;
178 size_t m_MissingBytes;
220 TcpReassemblyConfiguration(
bool removeConnInfo =
true, uint32_t closedConnectionDelay = 5, uint32_t maxNumToClean = 30, uint32_t maxOutOfOrderFragments = 0,
221 bool enableBaseBufferClearCondition =
true) : removeConnInfo(removeConnInfo), closedConnectionDelay(closedConnectionDelay), maxNumToClean(maxNumToClean), maxOutOfOrderFragments(maxOutOfOrderFragments), enableBaseBufferClearCondition(enableBaseBufferClearCondition)
243 TcpReassemblyConnectionClosedManually
320 typedef void (*OnTcpMessageReady)(int8_t side,
const TcpStreamData& tcpData,
void* userCookie);
328 typedef void (*OnTcpConnectionStart)(
const ConnectionData& connectionData,
void* userCookie);
370 void closeConnection(uint32_t
flowKey);
376 void closeAllConnections();
396 uint32_t purgeClosedConnections(uint32_t maxNumToClean = 0);
406 TcpFragment() : sequence(0), dataLength(0), data(NULL) {}
407 ~TcpFragment() {
delete [] data; }
410 struct TcpOneSideData
418 TcpOneSideData() :
srcPort(0), sequence(0), gotFinOrRst(
false) {}
421 struct TcpReassemblyData
426 TcpOneSideData twoSides[2];
429 TcpReassemblyData() : closed(
false), numOfSides(0), prevSide(-1) {}
432 typedef std::map<uint32_t, TcpReassemblyData> ConnectionList;
433 typedef std::map<time_t, std::list<uint32_t> > CleanupList;
435 OnTcpMessageReady m_OnMessageReadyCallback;
436 OnTcpConnectionStart m_OnConnStart;
437 OnTcpConnectionEnd m_OnConnEnd;
439 ConnectionList m_ConnectionList;
440 ConnectionInfoList m_ConnectionInfo;
441 CleanupList m_CleanupList;
442 bool m_RemoveConnInfo;
443 uint32_t m_ClosedConnectionDelay;
444 uint32_t m_MaxNumToClean;
445 size_t m_MaxOutOfOrderFragments;
446 time_t m_PurgeTimepoint;
447 bool m_EnableBaseBufferClearCondition;
449 void checkOutOfOrderFragments(TcpReassemblyData* tcpReassemblyData, int8_t sideIndex,
bool cleanWholeFragList);
451 void handleFinOrRst(TcpReassemblyData* tcpReassemblyData, int8_t sideIndex, uint32_t
flowKey,
bool isRst);
455 void insertIntoCleanupList(uint32_t flowKey);
The main namespace for the PcapPlusPlus lib.
std::map< uint32_t, ConnectionData > ConnectionInfoList
Definition: TcpReassembly.h:311
Definition: TcpReassembly.h:284
ConnectionData()
Definition: TcpReassembly.h:99
timeval getTimeStamp() const
Definition: TcpReassembly.h:173
TcpReassemblyConfiguration(bool removeConnInfo=true, uint32_t closedConnectionDelay=5, uint32_t maxNumToClean=30, uint32_t maxOutOfOrderFragments=0, bool enableBaseBufferClearCondition=true)
Definition: TcpReassembly.h:220
const ConnectionInfoList & getConnectionInformation() const
Definition: TcpReassembly.h:382
uint16_t srcPort
Definition: TcpReassembly.h:86
ConnectionEndReason
Definition: TcpReassembly.h:238
const ConnectionData & getConnectionData() const
Definition: TcpReassembly.h:167
timeval endTime
Definition: TcpReassembly.h:94
Definition: TcpReassembly.h:305
IPAddress dstIP
Definition: TcpReassembly.h:84
Definition: TcpReassembly.h:188
Definition: RawPacket.h:252
Definition: TcpReassembly.h:231
Definition: TcpReassembly.h:299
const uint8_t * getData() const
Definition: TcpReassembly.h:143
uint16_t dstPort
Definition: TcpReassembly.h:88
uint32_t closedConnectionDelay
Definition: TcpReassembly.h:196
uint32_t maxNumToClean
Definition: TcpReassembly.h:201
bool enableBaseBufferClearCondition
Definition: TcpReassembly.h:210
TcpStreamData(const uint8_t *tcpData, size_t tcpDataLength, size_t missingBytes, const ConnectionData &connData, timeval timestamp)
Definition: TcpReassembly.h:134
uint32_t maxOutOfOrderFragments
Definition: TcpReassembly.h:206
Definition: TcpReassembly.h:294
ReassemblyStatus
Definition: TcpReassembly.h:249
void setEndTime(const timeval &endTime)
Definition: TcpReassembly.h:111
Definition: TcpReassembly.h:259
uint32_t flowKey
Definition: TcpReassembly.h:90
size_t getMissingByteCount() const
Definition: TcpReassembly.h:155
bool removeConnInfo
Definition: TcpReassembly.h:191
Definition: TcpReassembly.h:123
bool isBytesMissing() const
Definition: TcpReassembly.h:161
Definition: TcpReassembly.h:279
timeval startTime
Definition: TcpReassembly.h:92
size_t getDataLength() const
Definition: TcpReassembly.h:149
Definition: TcpReassembly.h:79
Definition: IpAddress.h:278
IPAddress srcIP
Definition: TcpReassembly.h:82
void setStartTime(const timeval &startTime)
Definition: TcpReassembly.h:105
Definition: TcpReassembly.h:289
Definition: TcpReassembly.h:267
Definition: TcpReassembly.h:241
Definition: TcpReassembly.h:273