some questions with using tcp reassembly in PcapPlusPlus project

39 Views Asked by At

I have some questions when using the tcp reassembly module in PcapPlusPlus libraries.

The following description is the details about my project.

Project goal: Parsing out the business data from the tcp stream ( contains packet head and packet body) after processing by using PcapPlusPlus libraries.

Project structure

1、Using FPGA NIC drivers API to obtain frame data

2、Converting the frame data from step 1 to Raw Packet, and then calling reassemblePacket function. The following is the corresponding code.

auto rawPacket = pcpp::RawPacket(buffer, sz, ts, false,   pcpp::LinkLayerType::LINKTYPE_ETHERNET);  auto parsedPacket = pcpp::Packet(&rawPacket);  pcpp::TcpLayer *tcpLayer = parsedPacket.getLayerOfType<pcpp::TcpLayer>();  
if (tcpLayer != nullptr) 
{    
    tcpReassembly.reassemblePacket(&rawPacket); 
}

buffer means the frame data buffer;
sz means frame data length;
ts means the NIC timestamp; 3、Declare the tcp reassembly callback object and function

pcpp::TcpReassembly tcpReassembly(tcpReassemblyMsgReadyCallback);

static void tcpReassemblyMsgReadyCallback(int8_t sideIndex, const pcpp::TcpStreamData &tcpData, void *userCookie);

4、Parsing out the tcp stream data in the tcpReassemblyMsgReadyCallback function

questions:

Is the PcapPlusPlus thread safe? I tried to use the Intel oneTBB library to embed in my project because the frame data produces so fast. But the running results did not reach my goal. Some concurrency problems occurred. So is there any best solution to solve this problem? Are there any methods to improve the performance of the parsing process?

I tried to use the Intel oneTBB library to embed in my project because the frame data produces so fast. But the running results did not do well.

0

There are 0 best solutions below