#ifndef POTD_EVENT_H #define POTD_EVENT_H 1 #include #include "socket.h" #define POTD_MAXFD 32 #define POTD_MAXEVENTS 64 typedef struct event_ctx { int epoll_fd; int active; struct epoll_event events[POTD_MAXEVENTS]; } event_ctx; typedef int (*on_event_cb) (int fd, void *user_data); void event_init(event_ctx **ctx); int event_setup(event_ctx *ctx); int event_add_sock(event_ctx *ctx, psocket *sock); int event_add_fd(event_ctx *ctx, int fd); int event_loop(event_ctx *ctx, on_event_cb on_event, void *user_data); #endif