syslog-ng source
stats-registry.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2013 Balabit
3  * Copyright (c) 1998-2013 Balázs Scheidler
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * As an additional exemption you are allowed to compile & link against the
20  * OpenSSL libraries as published by the OpenSSL project. See the file
21  * COPYING for details.
22  *
23  */
24 #ifndef STATS_REGISTRY_H_INCLUDED
25 #define STATS_REGISTRY_H_INCLUDED 1
26 
27 #include "stats/stats.h"
28 #include "stats/stats-cluster.h"
29 
30 typedef void (*StatsForeachClusterFunc)(StatsCluster *sc, gpointer user_data);
31 typedef gboolean (*StatsForeachClusterRemoveFunc)(StatsCluster *sc, gpointer user_data);
32 
33 void stats_lock(void);
34 void stats_unlock(void);
35 gboolean stats_check_level(gint level);
36 StatsCluster *stats_register_counter(gint level, const StatsClusterKey *sc_key, gint type, StatsCounterItem **counter);
37 
38 StatsCluster *stats_register_external_counter(gint level, const StatsClusterKey *sc_key, gint type,
39  atomic_gssize *external_counter);
40 
41 StatsCluster *stats_register_alias_counter(gint level, const StatsClusterKey *sc_key, gint type,
42  StatsCounterItem *aliased_counter);
43 
44 StatsCluster *stats_register_counter_and_index(gint level, const StatsClusterKey *sc_key, gint type,
45  StatsCounterItem **counter);
46 StatsCluster *stats_register_dynamic_counter(gint stats_level, const StatsClusterKey *sc_key, gint type,
47  StatsCounterItem **counter);
48 void stats_register_and_increment_dynamic_counter(gint stats_level, const StatsClusterKey *sc_key, time_t timestamp);
49 void stats_register_associated_counter(StatsCluster *handle, gint type, StatsCounterItem **counter);
50 void stats_unregister_counter(const StatsClusterKey *sc_key, gint type, StatsCounterItem **counter);
51 void stats_unregister_external_counter(const StatsClusterKey *sc_key, gint type,
52  atomic_gssize *external_counter);
53 void stats_unregister_alias_counter(const StatsClusterKey *sc_key, gint type, StatsCounterItem *aliased_counter);
54 void stats_unregister_dynamic_counter(StatsCluster *handle, gint type, StatsCounterItem **counter);
55 
56 gboolean stats_contains_counter(const StatsClusterKey *sc_key, gint type);
57 StatsCounterItem *stats_get_counter(const StatsClusterKey *sc_key, gint type);
58 StatsCluster *stats_get_cluster(const StatsClusterKey *sc_key);
59 gboolean stats_remove_cluster(const StatsClusterKey *sc_key);
60 
61 void stats_foreach_counter(StatsForeachCounterFunc func, gpointer user_data, gboolean *cancelled);
62 void stats_foreach_legacy_counter(StatsForeachCounterFunc func, gpointer user_data, gboolean *cancelled);
63 void stats_foreach_cluster(StatsForeachClusterFunc func, gpointer user_data, gboolean *cancelled);
64 void stats_foreach_cluster_remove(StatsForeachClusterRemoveFunc func, gpointer user_data);
65 
66 void stats_registry_init(void);
67 void stats_registry_deinit(void);
68 
69 gboolean stats_check_dynamic_clusters_limit(guint number_of_clusters);
72 
73 #endif
CfgYesNoAuto
Definition: cfg-parser.h:69
void(* StatsForeachCounterFunc)(StatsCluster *sc, gint type, StatsCounterItem *counter, gpointer user_data)
Definition: stats-cluster.h:164
void(* StatsForeachClusterFunc)(StatsCluster *sc, gpointer user_data)
Definition: stats-registry.h:30
StatsCluster * stats_register_counter_and_index(gint level, const StatsClusterKey *sc_key, gint type, StatsCounterItem **counter)
gboolean(* StatsForeachClusterRemoveFunc)(StatsCluster *sc, gpointer user_data)
Definition: stats-registry.h:31
StatsCluster * stats_register_counter(gint level, const StatsClusterKey *sc_key, gint type, StatsCounterItem **counter)
Definition: stats-registry.c:225
void stats_foreach_legacy_counter(StatsForeachCounterFunc func, gpointer user_data, gboolean *cancelled)
Definition: stats-registry.c:497
void stats_unlock(void)
Definition: stats-registry.c:63
void stats_registry_init(void)
Definition: stats-registry.c:506
gboolean stats_check_level(gint level)
Definition: stats.c:267
StatsCluster * stats_register_dynamic_counter(gint stats_level, const StatsClusterKey *sc_key, gint type, StatsCounterItem **counter)
Definition: stats-registry.c:245
void stats_unregister_dynamic_counter(StatsCluster *handle, gint type, StatsCounterItem **counter)
Definition: stats-registry.c:342
StatsCounterItem * stats_get_counter(const StatsClusterKey *sc_key, gint type)
Definition: stats-registry.c:403
void stats_unregister_external_counter(const StatsClusterKey *sc_key, gint type, atomic_gssize *external_counter)
Definition: stats-registry.c:318
void stats_foreach_counter(StatsForeachCounterFunc func, gpointer user_data, gboolean *cancelled)
Definition: stats-registry.c:488
CfgYesNoAuto stats_syslog_stats(void)
Definition: stats.c:294
StatsCluster * stats_register_external_counter(gint level, const StatsClusterKey *sc_key, gint type, atomic_gssize *external_counter)
Definition: stats-registry.c:232
StatsCluster * stats_register_alias_counter(gint level, const StatsClusterKey *sc_key, gint type, StatsCounterItem *aliased_counter)
Definition: stats-registry.c:239
void stats_lock(void)
Definition: stats-registry.c:56
void stats_unregister_counter(const StatsClusterKey *sc_key, gint type, StatsCounterItem **counter)
Definition: stats-registry.c:302
void stats_register_and_increment_dynamic_counter(gint stats_level, const StatsClusterKey *sc_key, time_t timestamp)
Definition: stats-registry.c:258
void stats_register_associated_counter(StatsCluster *handle, gint type, StatsCounterItem **counter)
Definition: stats-registry.c:288
gboolean stats_remove_cluster(const StatsClusterKey *sc_key)
Definition: stats-registry.c:364
gint stats_number_of_dynamic_clusters_limit(void)
Definition: stats.c:286
gboolean stats_contains_counter(const StatsClusterKey *sc_key, gint type)
Definition: stats-registry.c:389
void stats_unregister_alias_counter(const StatsClusterKey *sc_key, gint type, StatsCounterItem *aliased_counter)
Definition: stats-registry.c:336
gboolean stats_check_dynamic_clusters_limit(guint number_of_clusters)
Definition: stats.c:276
void stats_foreach_cluster_remove(StatsForeachClusterRemoveFunc func, gpointer user_data)
Definition: stats-registry.c:463
void stats_foreach_cluster(StatsForeachClusterFunc func, gpointer user_data, gboolean *cancelled)
Definition: stats-registry.c:441
void stats_registry_deinit(void)
Definition: stats-registry.c:519
StatsCluster * stats_get_cluster(const StatsClusterKey *sc_key)
Definition: stats-registry.c:351
Definition: stats-cluster.h:155
Definition: stats-counter.h:67
Definition: atomic-gssize.h:33