Skip to content

Commit 3e6471c

Browse files
Adrian Duriskasedmicha
authored andcommitted
FDS output: Introduce support for periodic message
1 parent 9e66689 commit 3e6471c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/plugins/output/fds/src/fds.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ window_check(struct Instance &inst)
6868
int
6969
ipx_plugin_init(ipx_ctx_t *ctx, const char *params)
7070
{
71+
ipx_msg_mask_t mask = IPX_MSG_IPFIX | IPX_MSG_PERIODIC;
72+
if (ipx_ctx_subscribe(ctx, &mask, nullptr) != IPX_OK) {
73+
IPX_CTX_ERROR(ctx, "Error subscribing to messages", 0);
74+
return IPX_ERR_DENIED;
75+
}
76+
7177
try {
7278
// Parse configuration, try to create a storage and time window
7379
std::unique_ptr<Instance> instance(new Instance);
@@ -107,12 +113,15 @@ ipx_plugin_process(ipx_ctx_t *ctx, void *cfg, ipx_msg_t *msg)
107113
{
108114
auto *inst = reinterpret_cast<Instance *>(cfg);
109115
bool failed = false;
116+
ipx_msg_type msg_type = ipx_msg_get_type(msg);
110117

111118
try {
112119
// Check if the current time window should be closed
113120
window_check(*inst);
114-
ipx_msg_ipfix_t *msg_ipfix = ipx_msg_base2ipfix(msg);
115-
inst->storage_ptr->process_msg(msg_ipfix);
121+
if (msg_type == IPX_MSG_IPFIX) {
122+
ipx_msg_ipfix_t *msg_ipfix = ipx_msg_base2ipfix(msg);
123+
inst->storage_ptr->process_msg(msg_ipfix);
124+
}
116125
} catch (const FDS_exception &ex) {
117126
IPX_CTX_ERROR(ctx, "%s", ex.what());
118127
failed = true;

0 commit comments

Comments
 (0)