-
Notifications
You must be signed in to change notification settings - Fork 30
/
common_tool.h
43 lines (32 loc) · 1.12 KB
/
common_tool.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
#include "util.h"
#include "analyzer_util.h"
#include "INIReader.h"
#include "format_reader.h"
#ifdef _WIN32
#include "Winsock2.h"
#else
#include <sys/select.h>
#endif
class Common_Tool {
public:
Common_Tool() :
config_filename(default_config_filename)
{ }
void sighup_handler(int signal);
void parse_fd(Format_Reader *reader, int fd, ssize_t fd_size);
protected:
class INIReader *config() { return _config; };
void init_config();
const char *default_config_filename = "/etc/sololink.conf";
const char * config_filename;
virtual void sighup_received_tophalf();
bool _sighup_received = false; // FIXME: scope
virtual uint32_t select_timeout_us();
void select_loop();
virtual void pack_select_fds(fd_set &fds_read, fd_set &fds_write, fd_set &fds_err, uint8_t &nfds);
virtual void handle_select_fds(fd_set &fds_read, fd_set &fds_write, fd_set &fds_err, uint8_t &nfds);
virtual void do_idle_callbacks();
private:
void check_fds_are_empty_after_select(fd_set &fds_read, fd_set &fds_write, fd_set &fds_err, uint8_t nfds);
class INIReader *_config = NULL;
};