1 /*
2  * Copyright (C) 2007 iptelorg GmbH
3  *
4  * This file is part of Kamailio, a free SIP server.
5  *
6  * Kamailio is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version
10  *
11  * Kamailio 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  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19  */
20 /*!
21 * \file
22 * \brief Kamailio core :: local timer routines
23 * \ingroup core
24 * \author andrei
25 * Module: \ref core
26 *
27  * WARNING: this should be used only from within the same process.
28  * The local timers are not multi-process or multi-thread safe
29  *  (there are no locks)
30  *
31  */
32 
33 #ifndef _local_timer_h
34 #define _local_timer_h
35 
36 #include "timer_ticks.h"
37 #include "timer_funcs.h"
38 
39 
40 struct local_timer {
41 	/* private timer information */
42 	ticks_t prev_ticks; /* last time we ran the timer */
43 	struct timer_lists timer_lst; /* actual timer lists */
44 };
45 
46 
47 #define local_timer_init(tl, fun, param, flgs) timer_init(tl, fun, param, flgs)
48 
49 #define local_timer_reinit(tl) timer_reinit((tl))
50 
51 int init_local_timer(struct local_timer *lt_handle, ticks_t crt_ticks);
52 void destroy_local_timer(struct local_timer* lt_handle);
53 
54 int local_timer_add(struct local_timer* h, struct timer_ln* tl, ticks_t delta,
55 						ticks_t crt_ticks);
56 
57 void local_timer_del(struct local_timer* h, struct timer_ln* tl);
58 void local_timer_run(struct local_timer* lt, ticks_t crt_ticks);
59 
60 #endif /* _local_timer_h */
61