-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcapturethread.cpp
64 lines (56 loc) · 1.67 KB
/
capturethread.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "capturethread.h"
CaptureThread::CaptureThread(Nids *nids,
QString interface_name,
int cuda_device_num,
WINDOW_TYPE window_type,
int flush_buffer_size,
int flush_time):
save_to_file(NULL),
load_from_file(NULL),
gpu_enabled(true)
{
this->nids = nids;
this->interface_name = interface_name;
this->cuda_device_num = cuda_device_num;
this->window_type = window_type;
this->flush_buffer_size = flush_buffer_size;
this->flush_time = flush_time;
}
CaptureThread::CaptureThread(Nids *nids,
QString interface_name,
int threads_num):
save_to_file(NULL),
load_from_file(NULL),
gpu_enabled(false)
{
this->nids = nids;
this->interface_name = interface_name;
this->threads_num = threads_num;
}
void CaptureThread::run()
{
if (save_to_file) {
return;
}
if (load_from_file) {
return;
}
qDebug("starting capture thread");
if (gpu_enabled) {
nids->start_monitor_gpu(interface_name.toAscii().data(),
cuda_device_num,
window_type,
flush_buffer_size,
flush_time,
"nids_log.db");
} else {
nids->start_monitor(interface_name.toAscii().data(),
threads_num,
"nids_log.db");
}
qDebug("Capture thread finished");
}
void CaptureThread::stop()
{
nids->stop_monitor();
}