-
Notifications
You must be signed in to change notification settings - Fork 0
/
crypt_thread_t.h
55 lines (42 loc) · 1.22 KB
/
crypt_thread_t.h
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
//
// Created by macskas on 12/17/20.
//
#ifndef NSCA_CRYPT_THREAD_T_H
#define NSCA_CRYPT_THREAD_T_H
#include <mutex>
#include <condition_variable>
#include <queue>
#include "network_client.h"
#include "nsca_utils.h"
#define THREADMANAGER_METHOD_COMPUTE_HANDSHAKE 1
#define THREADMANAGER_METHOD_DECRYPT_PACKET 2
class crypt_queue_item_t {
public:
int method = 0;
network_client *networkClient;
crypt_queue_item_t(int method, network_client *nc) {
this->method = method;
this->networkClient = nc;
}
};
class crypt_thread_t {
private:
int thread_id = 0;
std::thread *myThread = nullptr;
struct crypt_instance *CI = nullptr;
std::mutex mtx;
std::condition_variable cv;
volatile bool shutdown_requested;
std::queue<crypt_queue_item_t> queue_items;
public:
crypt_thread_t(int myThreadId);
~crypt_thread_t();
void loop();
void add(int method, network_client *nc);
static
void loop_proxy(class crypt_thread_t *ct);
void join();
void set_CI(struct crypt_instance *);
struct crypt_instance *get_CI();
};
#endif //NSCA_CRYPT_THREAD_T_H