syslog-ng source
persist-tool.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 Balabit
3  * Copyright (c) 1998-2010 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 
25 #ifndef PERSIST_TOOL_H
26 #define PERSIST_TOOL_H 1
27 
28 #include "cfg.h"
29 #include "persist-state.h"
30 
31 
32 #define DEFAULT_PERSIST_FILE "syslog-ng.persist"
33 
34 typedef enum _PersistStateMode
35 {
40 
41 typedef struct _PersistTool
42 {
43  PersistState *state;
45  GlobalConfig *cfg;
47 } PersistTool;
48 
49 PersistTool *persist_tool_new(gchar *persist_filename, PersistStateMode open_mode);
50 
51 void persist_tool_free(PersistTool *self);
52 
53 typedef struct _StateHandler StateHandler;
54 
56 {
57  gpointer state;
58  gchar *name;
59  gsize size;
60  guint8 version;
62  PersistState *persist_state;
63  void (*free_fn)(StateHandler *self);
64 };
65 
66 typedef StateHandler *(*STATE_HANDLER_CONSTRUCTOR)(PersistState *persist_state, const gchar *name);
67 
69 void state_handler_register_constructor(const gchar *prefix,
71 
72 StateHandler *persist_tool_get_state_handler(PersistTool *self, gchar *name);
73 
75 
76 
77 #endif
const gchar * name
Definition: debugger.c:265
guint32 PersistEntryHandle
Definition: persist-state.h:53
StateHandler *(* STATE_HANDLER_CONSTRUCTOR)(PersistState *persist_state, const gchar *name)
Definition: persist-tool.h:66
PersistStateMode
Definition: persist-tool.h:35
@ persist_mode_dump
Definition: persist-tool.h:37
@ persist_mode_edit
Definition: persist-tool.h:38
@ persist_mode_normal
Definition: persist-tool.h:36
PersistTool * persist_tool_new(gchar *persist_filename, PersistStateMode open_mode)
Definition: persist-tool.c:97
void persist_tool_free(PersistTool *self)
Definition: persist-tool.c:112
void state_handler_register_constructor(const gchar *prefix, STATE_HANDLER_CONSTRUCTOR handler)
StateHandler * persist_tool_get_state_handler(PersistTool *self, gchar *name)
STATE_HANDLER_CONSTRUCTOR state_handler_get_constructor_by_prefix(const gchar *prefix)
void persist_tool_revert_changes(PersistTool *self)
Definition: persist-tool.c:86
Definition: persist-tool.h:42
PersistStateMode mode
Definition: persist-tool.h:44
gchar * persist_filename
Definition: persist-tool.h:46
GlobalConfig * cfg
Definition: persist-tool.h:45
PersistState * state
Definition: persist-tool.h:43
Definition: persist-tool.h:56
gpointer state
Definition: persist-tool.h:57
void(* free_fn)(StateHandler *self)
Definition: persist-tool.h:63
PersistState * persist_state
Definition: persist-tool.h:62
gsize size
Definition: persist-tool.h:59
guint8 version
Definition: persist-tool.h:60
PersistEntryHandle persist_handle
Definition: persist-tool.h:61
gchar * name
Definition: persist-tool.h:58