#ifndef foomainhfoo #define foomainhfoo #include #include struct cfg; #include "utils.h" extern bool exiting; 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 uring_task; /* To save typing in all the function definitions below */ typedef void (*callback_t)(struct cfg *, struct uring_task *, int res); typedef int (*rcallback_t)(struct cfg *, struct uring_task *, int res); struct uring_task_buf { char buf[4096]; size_t len; size_t done; }; struct uring_task { const char *name; unsigned refcount; int fd; struct uring_task *parent; void (*free)(struct uring_task *); bool dead; struct uring_task_buf *tbuf; callback_t callback; rcallback_t complete_callback; /* to check if tbuf processing is done */ callback_t final_callback; /* once tbuf processing is done */ struct sockaddr_in46 addr; /* used for recvmsg/sendmsg */ void *priv; }; struct cfg { const char *homedir; struct uring_ev *uev; struct inotify_ev *iev; struct signalfd_ev *sev; struct announce *aev; struct igmp *igmp; struct sd_bus *sd_bus; bool sd_bus_failed; struct uring_task task; struct list_head servers; }; #endif