event.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef TINC_EVENT_H
  2. #define TINC_EVENT_H
  3. /*
  4. event.h -- header for event.c
  5. Copyright (C) 2002-2009 Guus Sliepen <guus@tinc-vpn.org>,
  6. 2002-2005 Ivo Timmermans
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License along
  16. with this program; if not, write to the Free Software Foundation, Inc.,
  17. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. */
  19. #include "avl_tree.h"
  20. extern avl_tree_t *event_tree;
  21. typedef void (*event_handler_t)(void *);
  22. typedef struct event {
  23. time_t time;
  24. int id;
  25. event_handler_t handler;
  26. void *data;
  27. } event_t;
  28. extern void init_events(void);
  29. extern void exit_events(void);
  30. extern void expire_events(void);
  31. extern event_t *new_event(void) __attribute__((__malloc__));
  32. extern void free_event(event_t *event);
  33. extern void event_add(event_t *event);
  34. extern void event_del(event_t *event);
  35. extern event_t *get_expired_event(void);
  36. extern event_t *peek_next_event(void);
  37. #endif