syslog-ng source
timerwheel.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2012 Balabit
3  * Copyright (c) 1998-2012 Balázs Scheidler
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 as published
7  * by the Free Software Foundation, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * As an additional exemption you are allowed to compile & link against the
19  * OpenSSL libraries as published by the OpenSSL project. See the file
20  * COPYING for details.
21  *
22  */
23 
24 #ifndef CORRELATION_TIMERWHEEL_H_INCLUDED
25 #define CORRELATION_TIMERWHEEL_H_INCLUDED
26 
27 #include "syslog-ng.h"
28 
29 typedef struct _TWEntry TWEntry;
30 typedef struct _TimerWheel TimerWheel;
31 typedef void (*TWCallbackFunc)(TimerWheel *tw, guint64 now, gpointer user_data, gpointer caller_context);
32 
33 TWEntry *timer_wheel_add_timer(TimerWheel *self, gint timeout, TWCallbackFunc cb, gpointer user_data,
34  GDestroyNotify user_data_free);
35 void timer_wheel_del_timer(TimerWheel *self, TWEntry *entry);
36 void timer_wheel_mod_timer(TimerWheel *self, TWEntry *entry, gint new_timeout);
37 guint64 timer_wheel_get_timer_expiration(TimerWheel *self, TWEntry *entry);
38 
39 void timer_wheel_set_time(TimerWheel *self, guint64 new_now, gpointer caller_context);
40 guint64 timer_wheel_get_time(TimerWheel *self);
41 void timer_wheel_expire_all(TimerWheel *self, gpointer caller_context);
42 void timer_wheel_set_associated_data(TimerWheel *self, gpointer assoc_data, GDestroyNotify assoc_data_free);
43 gpointer timer_wheel_get_associated_data(TimerWheel *self);
44 TimerWheel *timer_wheel_new(void);
45 void timer_wheel_free(TimerWheel *self);
46 
47 
48 #endif
Definition: timerwheel.c:28
Definition: timerwheel.c:128
GDestroyNotify assoc_data_free
Definition: timerwheel.c:135
gpointer assoc_data
Definition: timerwheel.c:134
guint64 now
Definition: timerwheel.c:131
TimerWheel * timer_wheel_new(void)
Definition: timerwheel.c:384
gpointer timer_wheel_get_associated_data(TimerWheel *self)
Definition: timerwheel.c:378
void timer_wheel_mod_timer(TimerWheel *self, TWEntry *entry, gint new_timeout)
Definition: timerwheel.c:208
void(* TWCallbackFunc)(TimerWheel *tw, guint64 now, gpointer user_data, gpointer caller_context)
Definition: timerwheel.h:31
void timer_wheel_del_timer(TimerWheel *self, TWEntry *entry)
Definition: timerwheel.c:200
void timer_wheel_set_time(TimerWheel *self, guint64 new_now, gpointer caller_context)
Definition: timerwheel.c:297
guint64 timer_wheel_get_timer_expiration(TimerWheel *self, TWEntry *entry)
Definition: timerwheel.c:221
void timer_wheel_set_associated_data(TimerWheel *self, gpointer assoc_data, GDestroyNotify assoc_data_free)
Definition: timerwheel.c:370
guint64 timer_wheel_get_time(TimerWheel *self)
Definition: timerwheel.c:346
void timer_wheel_free(TimerWheel *self)
Definition: timerwheel.c:402
TWEntry * timer_wheel_add_timer(TimerWheel *self, gint timeout, TWCallbackFunc cb, gpointer user_data, GDestroyNotify user_data_free)
Definition: timerwheel.c:182
void timer_wheel_expire_all(TimerWheel *self, gpointer caller_context)
Definition: timerwheel.c:352