X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fevent.h;h=386c0b51a22c2676b682514cfb0c8a71ee6a1ee9;hb=28be4baae016a5a771d0d9ec6e97ef38a4fc9e46;hp=bd91b7b9ac1c616f9f587581b2da6a9bf7a22f3e;hpb=f9ab8e266b93aa3be772374ef4a8fdb06e376568;p=tinc diff --git a/src/event.h b/src/event.h index bd91b7b9..386c0b51 100644 --- a/src/event.h +++ b/src/event.h @@ -1,6 +1,9 @@ +#ifndef TINC_EVENT_H +#define TINC_EVENT_H + /* event.h -- I/O, timeout and signal event handling - Copyright (C) 2012 Guus Sliepen + Copyright (C) 2012-2013 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,9 +20,7 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __TINC_EVENT_H__ -#define __TINC_EVENT_H__ - +#include "system.h" #include "splay_tree.h" #define IO_READ 1 @@ -32,6 +33,9 @@ typedef void (*signal_cb_t)(void *data); typedef struct io_t { int fd; int flags; +#ifdef HAVE_WINDOWS + WSAEVENT event; +#endif io_cb_t cb; void *data; splay_node_t node; @@ -48,24 +52,29 @@ typedef struct signal_t { int signum; signal_cb_t cb; void *data; - splay_node_t node; } signal_t; extern struct timeval now; +extern splay_tree_t io_tree; +extern splay_tree_t timeout_tree; + extern void io_add(io_t *io, io_cb_t cb, void *data, int fd, int flags); +#ifdef HAVE_WINDOWS +extern void io_add_event(io_t *io, io_cb_t cb, void *data, WSAEVENT event); +#endif 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_add(timeout_t *timeout, timeout_cb_t cb, void *data, const struct timeval *tv); extern void timeout_del(timeout_t *timeout); -extern void timeout_set(timeout_t *timeout, struct timeval *tv); +extern void timeout_set(timeout_t *timeout, const struct timeval *tv); +extern struct timeval *timeout_execute(struct timeval *diff); 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