Skip to content

Commit 913d32e

Browse files
committed
SSADetector: SSADetectorRecord EXT completely defined
SSADetector: Removed initialization spaces
1 parent 560372a commit 913d32e

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

process/ssadetector.hpp

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#define IPXP_SSADETECTOR_HPP
4747

4848
#include <cstring>
49+
#include <sstream>
4950

5051
#ifdef WITH_NEMEA
5152
#include "fields.h"
@@ -70,13 +71,13 @@ UR_FIELDS (
7071
#define MAX_PKT_SIZE 150
7172
#define MAX_TIME_WINDOW 3000000 // in microseconds
7273
using dir_t = uint8_t;
74+
7375
/**
7476
* \brief Flow record extension header for storing parsed SSADETECTOR data.
7577
*/
7678
struct RecordExtSSADetector : public RecordExt {
7779
static int REGISTERED_ID;
7880

79-
8081
struct pkt_entry
8182
{
8283
pkt_entry();
@@ -88,7 +89,6 @@ struct RecordExtSSADetector : public RecordExt {
8889

8990
};
9091

91-
9292
struct pkt_table
9393
{
9494
public:
@@ -104,9 +104,24 @@ struct RecordExtSSADetector : public RecordExt {
104104
static inline bool time_in_window(const timeval& ts_now, const timeval& ts_old);
105105
inline bool entry_is_present(int8_t idx, dir_t dir, const timeval& ts_to_compare);
106106
};
107+
108+
109+
uint8_t possible_vpn {0}; // fidelity of this flow beint vpn
110+
uint64_t suspects {0};
111+
uint8_t syn_pkts_idx {0};
112+
uint8_t syn_pkts[SYN_RECORDS_NUM];
113+
114+
pkt_table syn_table{};
115+
pkt_table syn_ack_table{};
116+
107117
RecordExtSSADetector() : RecordExt(REGISTERED_ID)
108118
{
109-
possible_vpn = 0;
119+
}
120+
121+
void reset ()
122+
{
123+
syn_table.reset();
124+
syn_ack_table.reset();
110125
}
111126

112127
#ifdef WITH_NEMEA
@@ -138,6 +153,13 @@ struct RecordExtSSADetector : public RecordExt {
138153
};
139154
return ipfix_template;
140155
}
156+
157+
std::string get_text() const
158+
{
159+
std::ostringstream out;
160+
out << "SSA=" << (int)possible_vpn;
161+
return out.str();
162+
}
141163
};
142164

143165
/**

0 commit comments

Comments
 (0)