summaryrefslogtreecommitdiff
path: root/ecp/server/server.h
blob: e8705a78c25d29a9a68c1804c7b7abdddc4c765e (plain)
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
#define LOG_ERR             0
#define LOG_INFO            1
#define LOG_DEBUG           2

#define LOG_MAX_LEVEL       2
#define LOG(l, ...)         { log_printf(l, __VA_ARGS__); }

#define MAX_THREADS         128

typedef struct SRVConfig {
    ECPDHKey key_perma;
    ECPSocket *sock;
    char *acl_fn;
    char *acl_fn_dir;
    ecp_tr_addr_t my_addr;
    uint8_t region;
    uint8_t roles;
    int detach;
    unsigned int rcvr_thd_num;
    pthread_t rcvr_thd[MAX_THREADS];
    unsigned int log_level;
    char *log_fn;
    FILE *log_file;
    uid_t uid;
    gid_t gid;
} SRVConfig;

SRVConfig *srv_get_config(void);
int conn_expired(ECPConnection *conn, ecp_sts_t now);
void log_vprintf(int level, const char *format, va_list ap);
void log_printf(int level, const char *format, ...);