syslog-ng source
correlation.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2013, 2015 Balabit
3  * Copyright (c) 1998-2013, 2015 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 #ifndef CORRELATION_CORRELATION_H_INCLUDED
24 #define CORRELATION_CORRELATION_H_INCLUDED
25 
26 #include "syslog-ng.h"
27 #include "correlation-key.h"
28 #include "correlation-context.h"
29 #include "timerwheel.h"
30 #include "timeutils/unixtime.h"
31 
32 typedef struct _CorrelationState
33 {
35  GMutex lock;
36  GHashTable *state;
37  TimerWheel *timer_wheel;
39  struct timespec last_tick;
41 
45 void correlation_state_tx_store_context(CorrelationState *self, CorrelationContext *context, gint timeout);
46 void correlation_state_tx_remove_context(CorrelationState *self, CorrelationContext *context);
47 void correlation_state_tx_update_context(CorrelationState *self, CorrelationContext *context, gint timeout);
48 
49 void correlation_state_set_time(CorrelationState *self, guint64 sec, gpointer caller_context);
51 gboolean correlation_state_timer_tick(CorrelationState *self, gpointer caller_context);
52 void correlation_state_expire_all(CorrelationState *self, gpointer caller_context);
53 void correlation_state_advance_time(CorrelationState *self, gint timeout, gpointer caller_context);
54 
60 
61 #endif
void correlation_state_deinit_instance(CorrelationState *self)
CorrelationState * correlation_state_new(TWCallbackFunc expire)
Definition: correlation.c:158
void correlation_state_advance_time(CorrelationState *self, gint timeout, gpointer caller_context)
Definition: correlation.c:85
void correlation_state_unref(CorrelationState *self)
Definition: correlation.c:195
void correlation_state_tx_update_context(CorrelationState *self, CorrelationContext *context, gint timeout)
Definition: correlation.c:69
guint64 correlation_state_get_time(CorrelationState *self)
Definition: correlation.c:117
void correlation_state_tx_remove_context(CorrelationState *self, CorrelationContext *context)
Definition: correlation.c:58
void correlation_state_set_time(CorrelationState *self, guint64 sec, gpointer caller_context)
Definition: correlation.c:96
void correlation_state_expire_all(CorrelationState *self, gpointer caller_context)
Definition: correlation.c:77
CorrelationState * correlation_state_ref(CorrelationState *self)
Definition: correlation.c:183
CorrelationContext * correlation_state_tx_lookup_context(CorrelationState *self, const CorrelationKey *key)
Definition: correlation.c:42
void correlation_state_tx_store_context(CorrelationState *self, CorrelationContext *context, gint timeout)
Definition: correlation.c:48
void correlation_state_tx_begin(CorrelationState *self)
Definition: correlation.c:30
void correlation_state_init_instance(CorrelationState *self)
void correlation_state_tx_end(CorrelationState *self)
Definition: correlation.c:36
gboolean correlation_state_timer_tick(CorrelationState *self, gpointer caller_context)
Definition: correlation.c:123
Definition: correlation-key.h:47
Definition: correlation.h:33
GMutex lock
Definition: correlation.h:35
TimerWheel * timer_wheel
Definition: correlation.h:37
GAtomicCounter ref_cnt
Definition: correlation.h:34
GHashTable * state
Definition: correlation.h:36
TWCallbackFunc expire_callback
Definition: correlation.h:38
Definition: atomic.h:31
void(* TWCallbackFunc)(TimerWheel *tw, guint64 now, gpointer user_data, gpointer caller_context)
Definition: timerwheel.h:31
struct tm key
Definition: cache.c:63