syslog-ng source
afsql.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 AFSQL_H_INCLUDED
25 #define AFSQL_H_INCLUDED
26 
27 #pragma GCC diagnostic ignored "-Wstrict-prototypes"
28 
30 #include "mainloop-worker.h"
31 #include "string-list.h"
32 
33 #include <dbi.h>
34 
35 /* field flags */
36 enum
37 {
38  AFSQL_FF_DEFAULT = 0x0001,
39 };
40 
41 /* destination driver flags */
42 enum
43 {
46 };
47 
48 typedef struct _AFSqlField
49 {
50  guint32 flags;
51  gchar *name;
52  gchar *type;
53  LogTemplate *value;
54 } AFSqlField;
55 
67 typedef struct _AFSqlDestDriver
68 {
69  LogThreadedDestDriver super;
70  /* read by the db thread */
71  gchar *type;
72  gchar *host;
73  gchar *port;
74  gchar *user;
75  gchar *password;
76  gchar *database;
77  gchar *encoding;
79  GList *columns;
80  GList *values;
81  GList *indexes;
82  LogTemplate *table;
83  gint fields_len;
85  gchar *null_value;
89 
90  LogTemplateOptions template_options;
91 
92  GHashTable *dbd_options;
93  GHashTable *dbd_options_numeric;
94 
95  /* used exclusively by the db thread */
96  dbi_conn dbi_ctx;
102 
103 
104 void afsql_dd_set_type(LogDriver *s, const gchar *type);
105 void afsql_dd_set_host(LogDriver *s, const gchar *host);
106 void afsql_dd_set_port(LogDriver *s, const gchar *port);
107 void afsql_dd_set_user(LogDriver *s, const gchar *user);
108 void afsql_dd_set_password(LogDriver *s, const gchar *password);
109 void afsql_dd_set_database(LogDriver *s, const gchar *database);
110 void afsql_dd_set_table(LogDriver *s, LogTemplate *table_template);
111 void afsql_dd_set_columns(LogDriver *s, GList *columns);
112 void afsql_dd_set_values(LogDriver *s, GList *values);
113 void afsql_dd_set_null_value(LogDriver *s, const gchar *null);
114 void afsql_dd_set_indexes(LogDriver *s, GList *indexes);
115 void afsql_dd_set_session_statements(LogDriver *s, GList *session_statements);
116 void afsql_dd_set_create_statement_append(LogDriver *s, const gchar *create_statement_append);
117 LogDriver *afsql_dd_new(GlobalConfig *cfg);
118 gint afsql_dd_lookup_flag(const gchar *flag);
119 void afsql_dd_add_dbd_option(LogDriver *s, const gchar *name, const gchar *value);
120 void afsql_dd_add_dbd_option_numeric(LogDriver *s, const gchar *name, gint value);
121 void afsql_dd_set_dbi_driver_dir(LogDriver *s, const gchar *dbi_driver_dir);
122 void afsql_dd_set_quote_char(LogDriver *s, const gchar *quote);
123 void afsql_dd_set_ignore_tns_config(LogDriver *s, const gboolean ignore_tns_config);
124 
125 gboolean afsql_dd_process_flag(LogDriver *driver, const gchar *flag);
126 
127 
128 #endif
void afsql_dd_set_user(LogDriver *s, const gchar *user)
Definition: afsql.c:114
void afsql_dd_set_dbi_driver_dir(LogDriver *s, const gchar *dbi_driver_dir)
Definition: afsql.c:67
void afsql_dd_set_columns(LogDriver *s, GList *columns)
Definition: afsql.c:150
gint afsql_dd_lookup_flag(const gchar *flag)
void afsql_dd_set_values(LogDriver *s, GList *values)
Definition: afsql.c:168
void afsql_dd_set_database(LogDriver *s, const gchar *database)
Definition: afsql.c:132
@ AFSQL_FF_DEFAULT
Definition: afsql.h:38
void afsql_dd_set_type(LogDriver *s, const gchar *type)
Definition: afsql.c:85
void afsql_dd_set_table(LogDriver *s, LogTemplate *table_template)
Definition: afsql.c:141
void afsql_dd_set_create_statement_append(LogDriver *s, const gchar *create_statement_append)
Definition: afsql.c:203
void afsql_dd_set_host(LogDriver *s, const gchar *host)
Definition: afsql.c:96
void afsql_dd_set_quote_char(LogDriver *s, const gchar *quote)
Definition: afsql.c:76
void afsql_dd_set_null_value(LogDriver *s, const gchar *null)
Definition: afsql.c:177
void afsql_dd_set_indexes(LogDriver *s, GList *indexes)
Definition: afsql.c:159
void afsql_dd_add_dbd_option_numeric(LogDriver *s, const gchar *name, gint value)
Definition: afsql.c:59
@ AFSQL_DDF_DONT_CREATE_TABLES
Definition: afsql.h:45
@ AFSQL_DDF_EXPLICIT_COMMITS
Definition: afsql.h:44
void afsql_dd_set_password(LogDriver *s, const gchar *password)
Definition: afsql.c:123
void afsql_dd_set_ignore_tns_config(LogDriver *s, const gboolean ignore_tns_config)
Definition: afsql.c:187
gboolean afsql_dd_process_flag(LogDriver *driver, const gchar *flag)
Definition: afsql.c:1358
LogDriver * afsql_dd_new(GlobalConfig *cfg)
Definition: afsql.c:1307
void afsql_dd_set_port(LogDriver *s, const gchar *port)
Definition: afsql.c:105
void afsql_dd_add_dbd_option(LogDriver *s, const gchar *name, const gchar *value)
Definition: afsql.c:51
void afsql_dd_set_session_statements(LogDriver *s, GList *session_statements)
Definition: afsql.c:195
const gchar * name
Definition: debugger.c:265
const gchar * user
Definition: gprocess.c:120
Definition: afsql.h:68
gchar * user
Definition: afsql.h:74
gchar * create_statement_append
Definition: afsql.h:78
gchar * dbi_driver_dir
Definition: afsql.h:97
GList * columns
Definition: afsql.h:79
gchar * encoding
Definition: afsql.h:77
dbi_conn dbi_ctx
Definition: afsql.h:96
GHashTable * dbd_options
Definition: afsql.h:92
gchar * type
Definition: afsql.h:71
gchar * quote_as_string
Definition: afsql.h:86
GHashTable * syslogng_conform_tables
Definition: afsql.h:98
guint32 failed_message_counter
Definition: afsql.h:99
gchar * port
Definition: afsql.h:73
GList * values
Definition: afsql.h:80
LogTemplate * table
Definition: afsql.h:82
gchar * null_value
Definition: afsql.h:85
gboolean transaction_active
Definition: afsql.h:100
GList * session_statements
Definition: afsql.h:88
gchar * host
Definition: afsql.h:72
LogTemplateOptions template_options
Definition: afsql.h:90
LogThreadedDestDriver super
Definition: afsql.h:69
gboolean ignore_tns_config
Definition: afsql.h:87
gchar * database
Definition: afsql.h:76
GHashTable * dbd_options_numeric
Definition: afsql.h:93
GList * indexes
Definition: afsql.h:81
gint fields_len
Definition: afsql.h:83
AFSqlField * fields
Definition: afsql.h:84
gchar * password
Definition: afsql.h:75
Definition: afsql.h:49
gchar * name
Definition: afsql.h:51
LogTemplate * value
Definition: afsql.h:53
gchar * type
Definition: afsql.h:52
guint32 flags
Definition: afsql.h:50
GlobalConfig * cfg
Definition: test_batched_ack_tracker.c:34
GString * value
Definition: test_decode.c:28
HTTPDestinationDriver * driver
Definition: test_http-signal_slot.c:35