timer.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * $Id$
  3. *
  4. *
  5. * timer related functions
  6. *
  7. * Copyright (C) 2001-2003 Fhg Fokus
  8. *
  9. * This file is part of ser, a free SIP server.
  10. *
  11. * ser is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version
  15. *
  16. * For a license to use the ser software under conditions
  17. * other than those described here, or to purchase support for this
  18. * software, please contact iptel.org by e-mail at the following addresses:
  19. * [email protected]
  20. *
  21. * ser is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with this program; if not, write to the Free Software
  28. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  29. */
  30. #ifndef timer_h
  31. #define timer_h
  32. typedef void (timer_function)(unsigned int ticks, void* param);
  33. struct sr_timer{
  34. int id;
  35. timer_function* timer_f;
  36. void* t_param;
  37. unsigned int interval;
  38. unsigned int expires;
  39. struct sr_timer* next;
  40. };
  41. extern struct sr_timer* timer_list;
  42. int init_timer();
  43. /*register a periodic timer;
  44. * ret: <0 on errror*/
  45. int register_timer(timer_function f, void* param, unsigned int interval);
  46. unsigned int get_ticks();
  47. void timer_ticker();
  48. #endif