-} event_t;
-
-extern void init_events(void);
-extern void exit_events(void);
-extern void flush_events(void);
-extern event_t *new_event(void) __attribute__ ((__malloc__));
-extern void free_event(event_t *);
-extern void event_add(event_t *);
-extern void event_del(event_t *);
-extern event_t *get_expired_event(void);
-
-#endif /* __TINC_EVENT_H__ */
+ struct splay_node_t node;
+} signal_t;
+
+extern struct timeval now;
+
+extern void io_add(io_t *io, io_cb_t cb, void *data, int fd, int flags);
+extern void io_del(io_t *io);
+extern void io_set(io_t *io, int flags);
+
+extern void timeout_add(timeout_t *timeout, timeout_cb_t cb, void *data, struct timeval *tv);
+extern void timeout_del(timeout_t *timeout);
+extern void timeout_set(timeout_t *timeout, struct timeval *tv);
+
+extern void signal_add(signal_t *sig, signal_cb_t cb, void *data, int signum);
+extern void signal_del(signal_t *sig);
+
+extern bool event_loop(void);
+extern void event_flush_output(void);
+extern void event_exit(void);
+
+#endif