Skip to content

Commit 47879b5

Browse files
author
Damir Zainullin
committed
++
1 parent dbec72a commit 47879b5

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

include/ipfixprobe/processPlugin/flowKey.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <cstdint>
44

55
#include "ipAddress.hpp"
6+
#include "xxhash.h"
67

78
namespace ipxp {
89

@@ -29,7 +30,7 @@ struct FlowKey {
2930
constexpr inline
3031
std::size_t hash() const noexcept
3132
{
32-
return 0; //XXH3_64bits(this, sizeof(*this), 0);
33+
return XXH3_64bits(this, sizeof(*this));
3334
}
3435
};
3536

include/ipfixprobe/processPlugin/processPlugin.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace ipxp {
2525
*/
2626
class FlowRecord;
2727
class Packet;
28-
class PacketFeatures;
28+
class PacketFeatures{};
2929

3030
/**
3131
* @brief Context passed to plugin methods, containing references to flow and packet.

include/ipfixprobe/processPlugin/processPluginManager.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "processPlugin.hpp"
66
#include "processPluginEntry.hpp"
77
#include "flowRecordBuilder.hpp"
8+
#include "flowKey.hpp"
89
#include "../pluginFactory/pluginFactory.hpp"
910
#include "../api.hpp"
1011

@@ -192,7 +193,7 @@ class IPXP_API ProcessPluginManager {
192193

193194
std::shared_ptr<FlowRecordBuilder> rebuild()
194195
{
195-
auto builder = std::make_shared<FlowRecordBuilder>(m_processPlugins, FlowKey::DEFAULT_LAYOUT);
196+
auto builder = std::make_shared<FlowRecordBuilder>(m_processPlugins, FlowKey::getLayout());
196197
return builder;
197198
}
198199

src/plugins/storage/cache/src/cache.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ void NHTFlowCache::export_flow(size_t index)
171171
m_flow_table[index]->directionalData[Direction::Forward].packets + m_flow_table[index]->directionalData[Direction::Reverse].packets);
172172
m_flows_in_cache--;
173173

174-
ipx_ring_push(m_export_queue, m_flow_table[index].get());
175174
std::swap(m_flow_table[index], m_flow_table[m_cache_size + m_qidx]);
175+
ipx_ring_push(m_export_queue, &m_flow_table[m_cache_size + m_qidx]);
176176
m_flow_table[index]->erase();
177177
m_qidx = (m_qidx + 1) % m_qsize;
178178
}
@@ -338,9 +338,16 @@ int NHTFlowCache::put_pkt(Packet& pkt)
338338
return 0;
339339
}
340340

341+
auto features = PacketFeatures{};
342+
auto context = FlowContext {
343+
.flowRecord = *flow,
344+
.packet = pkt,
345+
.features = features
346+
};
341347
if (flow->isEmpty()) {
342348
m_flows_in_cache++;
343349
flow->createFrom(pkt, hashval);
350+
m_manager.processFlowRecord(context);
344351
ret = 0; //plugins_post_create(flow->m_flow, pkt);
345352

346353
//if (ret & FLOW_FLUSH) {

0 commit comments

Comments
 (0)