1 /*
2  * Copyright (c) 2019 Balabit
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library 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 GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; 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 SYSLOG_NG_CTL_COMMANDS_H_INCLUDED
25 #define SYSLOG_NG_CTL_COMMANDS_H_INCLUDED 1
26 
27 #include "syslog-ng.h"
28 #include "secret-storage/secret-storage.h"
29 
30 #include <stdio.h>
31 
32 extern GOptionEntry no_options[];
33 
34 typedef struct _CommandDescriptor
35 {
36   const gchar *mode;
37   const GOptionEntry *options;
38   const gchar *description;
39   gint (*main)(gint argc, gchar *argv[], const gchar *mode, GOptionContext *ctx);
40   struct _CommandDescriptor *subcommands;
41 } CommandDescriptor;
42 
43 gint dispatch_command(const gchar *cmd);
44 GString *slng_run_command(const gchar *command);
45 gint process_response_status(GString *response);
46 gboolean is_syslog_ng_running(void);
47 
48 gint run(const gchar *control_name, gint argc, gchar **argv, CommandDescriptor *mode, GOptionContext *ctx);
49 #endif
50