summaryrefslogtreecommitdiff
path: root/main.h
blob: d327059a4dbd22c8c7a08c4580867e7033c0bf68 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef foomainhfoo
#define foomainhfoo

#include <sys/socket.h>
#include <netinet/ip.h>
#include "utils.h"

extern int debuglvl;

void debug(unsigned lvl, const char *fmt, ...);

#define info(...) fprintf(stderr, __VA_ARGS__)
#define error(...) fprintf(stderr, __VA_ARGS__)

void die(const char *fmt, ...);

#define perrordie(msg) die("%s: %m\n", msg)

struct cfg;

struct uring_task;

/* To save typing in all the function definitions below */
typedef void (*callback_t)(struct cfg *, struct uring_task *, int res);

struct uring_task {
	const char *name;
        unsigned refcount;
	int fd;
        void *parent;
        void (*free)(struct uring_task *);
	bool dead;
        callback_t callback;
};

struct cfg {
	const char *homedir;
	struct uring_ev *uev;
	struct inotify_ev *iev;
	struct signalfd_ev *sev;
	struct announce *aev;
	struct uring_task task;
	struct list_head servers;
};

#endif