This repository has been archived by the owner on Jun 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathcore.h
60 lines (46 loc) · 1.43 KB
/
core.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
56
57
58
59
60
#ifndef _CORE_H
#define _CORE_H
#include <pthread.h>
#include "main.h"
#include "socket.h"
#define HTTP_TIMEOUT_SOCK 5 /* in seconds, used for select() call in thread */
#define MAX_VERBOSE_LEVEL 4
#include <sys/select.h>
#ifndef FD_SETSIZE
#define FD_SETSIZE 256
#endif
typedef enum proxenet_states {
INACTIVE, /* initial state */
SLEEPING, /* = means not to treat new request */
ACTIVE, /* rock'n roll */
} proxenet_state;
#include "plugin.h"
typedef struct thread_info {
pthread_t thread_id;
int thread_num;
sock_t sock;
pthread_t main_tid;
pthread_mutex_t* mutex;
plugin_t** plugin_list;
} tinfo_t;
/* stats stuff */
unsigned long bytes_sent;
unsigned long bytes_recv;
time_t start_time;
time_t end_time;
unsigned long request_id;
proxenet_state proxy_state;
unsigned long active_threads_bitmask;
plugin_t* plugins_list; /* points to first plugin */
pthread_t threads[MAX_THREADS];
pthread_t main_thread_id;
int proxenet_start();
unsigned int get_active_threads_size();
bool is_thread_active(int);
int proxenet_toggle_plugin(int);
void proxenet_destroy_plugins_vm();
int proxenet_initialize_plugins_list();
void proxenet_initialize_plugins();
void proxenet_xloop(sock_t, sock_t);
int proxenet_kill_thread(pthread_t);
#endif /* _CORE_H */