-
Notifications
You must be signed in to change notification settings - Fork 9
/
hasses.h
79 lines (65 loc) · 1.94 KB
/
hasses.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* Asynchronous SSE Server
* Author: Peter Deak (hyper80@gmail.com)
* License: GPL
*/
#ifndef HASSES_HASSES_H
#define HASSES_HASSES_H
#define VERSION "1.30"
/* The client timeout check interval in seconds */
#define CLIENT_CHK_TIME_INTERVAL 60
/* A connected handshaked sse client connection will be dropped after this seconds */
#define CLIENT_HANDSHAKED_TIMEOUT 3600
/* A not fully handshaked so not sse client connection will be dropped after this seconds */
#define CLIENT_NOTHSHAKED_TIMEOUT 20
/* Client database bank size. (Client array size in one list element */
#define BANKSIZE 256
/* Epoll_create() parameter, maximum watched descriptor. */
#define MAXEVENTS 10000
/* Maximum reading message size, from network side. (Url req, etc) */
#define MAX_READ_SIZE 6144
#define NON_TCP_SENDER -1
struct Hasses_Settings
{
int loglevel;
int use_ssl;
int reinit_allowed;
int paramuid;
int nodaemon;
char match_url[64];
char fifofile[128];
char logfile[128];
char pidfile[128];
char paramuser[64];
char certfile[128];
char pkeyfile[128];
char corsbase[128];
char delimiter[2];
};
struct Hasses_Statistics
{
time_t startDaemon;
unsigned long maxclients;
unsigned long allclient;
unsigned long allreinit;
unsigned long allmessage;
unsigned long allsmessage;
};
size_t h_strlcpy(char *dest, const char *src, size_t size);
void toLog(int level, const char * format, ...);
void checkTimeouts(void);
int close_client(int d);
int commands(char *input, int sender_fd);
int get_reinit_allowed(void);
void diffsec_to_str(int diff_sec,char *buffer,int max);
void beforeExit(void);
void parse_comm_messages(char *fms, int sender_fd);
void parse_comm_message(char *fm, int sender_fd);
struct CommCli {
int fd;
struct CommCli *next;
};
void commclient_add(int fd);
void commclient_del(int fd);
int commclient_check(int fd);
void commclient_debug(void);
#endif