Asterisk - The Open Source Telephony Project  18.5.0
Data Structures | Macros | Functions | Variables
cel_sqlite3_custom.c File Reference

Custom SQLite3 CEL records. More...

#include "asterisk.h"
#include <sqlite3.h>
#include "asterisk/paths.h"
#include "asterisk/channel.h"
#include "asterisk/cel.h"
#include "asterisk/module.h"
#include "asterisk/config.h"
#include "asterisk/pbx.h"
#include "asterisk/logger.h"
#include "asterisk/utils.h"
#include "asterisk/cli.h"
#include "asterisk/options.h"
#include "asterisk/stringfields.h"
Include dependency graph for cel_sqlite3_custom.c:

Go to the source code of this file.

Data Structures

struct  sql_values
 
struct  values
 

Macros

#define SQLITE_BACKEND_NAME   "CEL sqlite3 custom backend"
 

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static void free_config (void)
 
static int load_column_config (const char *tmp)
 
static int load_config (int reload)
 
static int load_module (void)
 
static int load_values_config (const char *tmp)
 
static int reload (void)
 
static int unload_module (void)
 
static void write_cel (struct ast_event *event)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "SQLite3 Custom CEL Module" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CDR_DRIVER, .requires = "cel", }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static int busy_timeout
 
static char * columns
 
static const char config_file [] = "cel_sqlite3_custom.conf"
 
static sqlite3 * db = NULL
 
static ast_mutex_t lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} }
 
static struct sql_values sql_values = { .first = NULL, .last = NULL, .lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } , }
 
static char table [80]
 

Detailed Description

Custom SQLite3 CEL records.

Author
Adapted by Steve Murphy murf@.nosp@m.digi.nosp@m.um.co.nosp@m.m from Alejandro Rios aleja.nosp@m.ndro.nosp@m..rios.nosp@m.@ava.nosp@m.tar.c.nosp@m.om.c.nosp@m.o and Russell Bryant russe.nosp@m.ll@d.nosp@m.igium.nosp@m..com from cdr_mysql_custom by Edward Eastman ed@dm.nosp@m.3.co.nosp@m..uk, and cdr_sqlite by Holger Schurig hs423.nosp@m.3@ma.nosp@m.il.mn.nosp@m.-sol.nosp@m.ution.nosp@m.s.de

Definition in file cel_sqlite3_custom.c.

Macro Definition Documentation

◆ SQLITE_BACKEND_NAME

#define SQLITE_BACKEND_NAME   "CEL sqlite3 custom backend"

Definition at line 58 of file cel_sqlite3_custom.c.

Referenced by load_module(), and unload_module().

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 364 of file cel_sqlite3_custom.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 364 of file cel_sqlite3_custom.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module* AST_MODULE_SELF_SYM ( void  )

Definition at line 364 of file cel_sqlite3_custom.c.

◆ free_config()

static void free_config ( void  )
static

Definition at line 221 of file cel_sqlite3_custom.c.

References ast_free, AST_LIST_REMOVE_HEAD, db, values::list, NULL, and value.

Referenced by load_config(), load_module(), and unload_module().

222 {
223  struct values *value;
224 
225  if (db) {
226  sqlite3_close(db);
227  db = NULL;
228  }
229 
230  if (columns) {
231  ast_free(columns);
232  columns = NULL;
233  }
234 
235  while ((value = AST_LIST_REMOVE_HEAD(&sql_values, list))) {
236  ast_free(value);
237  }
238 }
struct values::@101 list
#define NULL
Definition: resample.c:96
int value
Definition: syslog.c:37
static sqlite3 * db
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
Definition: linkedlists.h:832
#define ast_free(a)
Definition: astmm.h:182

◆ load_column_config()

static int load_column_config ( const char *  tmp)
static

Definition at line 82 of file cel_sqlite3_custom.c.

References ast_free, ast_log, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_strlen(), ast_strdup, ast_strip(), ast_strlen_zero, LOG_ERROR, LOG_WARNING, NULL, strsep(), and table.

Referenced by load_config().

83 {
84  char *col = NULL;
85  char *cols = NULL, *save = NULL;
86  char *escaped = NULL;
87  struct ast_str *column_string = NULL;
88 
89  if (ast_strlen_zero(tmp)) {
90  ast_log(LOG_WARNING, "Column names not specified. Module not loaded.\n");
91  return -1;
92  }
93  if (!(column_string = ast_str_create(1024))) {
94  ast_log(LOG_ERROR, "Out of memory creating temporary buffer for column list for table '%s.'\n", table);
95  return -1;
96  }
97  if (!(save = cols = ast_strdup(tmp))) {
98  ast_log(LOG_ERROR, "Out of memory creating temporary buffer for column list for table '%s.'\n", table);
99  ast_free(column_string);
100  return -1;
101  }
102  while ((col = strsep(&cols, ","))) {
103  col = ast_strip(col);
104  escaped = sqlite3_mprintf("%q", col);
105  if (!escaped) {
106  ast_log(LOG_ERROR, "Out of memory creating entry for column '%s' in table '%s.'\n", col, table);
107  ast_free(column_string);
108  ast_free(save);
109  return -1;
110  }
111  ast_str_append(&column_string, 0, "%s%s", ast_str_strlen(column_string) ? "," : "", escaped);
112  sqlite3_free(escaped);
113  }
114  if (!(columns = ast_strdup(ast_str_buffer(column_string)))) {
115  ast_log(LOG_ERROR, "Out of memory copying columns string for table '%s.'\n", table);
116  ast_free(column_string);
117  ast_free(save);
118  return -1;
119  }
120  ast_free(column_string);
121  ast_free(save);
122 
123  return 0;
124 }
#define LOG_WARNING
Definition: logger.h:274
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Definition: strings.h:714
static int tmp()
Definition: bt_open.c:389
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition: strings.h:1091
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:243
#define NULL
Definition: resample.c:96
#define ast_strlen_zero(foo)
Definition: strings.h:52
#define ast_log
Definition: astobj2.c:42
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
Definition: strings.h:219
#define LOG_ERROR
Definition: logger.h:285
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
Definition: strings.h:584
#define ast_free(a)
Definition: astmm.h:182
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
Definition: strings.h:688
char * strsep(char **str, const char *delims)
static char table[80]
#define ast_str_create(init_len)
Create a malloc&#39;ed dynamic length string.
Definition: strings.h:620

◆ load_config()

static int load_config ( int  reload)
static

Definition at line 158 of file cel_sqlite3_custom.c.

References ast_config_destroy(), ast_config_load, ast_copy_string(), ast_log, ast_parse_arg(), ast_strlen_zero, ast_variable_browse(), ast_variable_retrieve(), ast_verb, busy_timeout, config_file, CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEMISSING, CONFIG_STATUS_FILEUNCHANGED, free_config(), load_column_config(), load_values_config(), LOG_WARNING, NULL, PARSE_DEFAULT, PARSE_INT32, table, and tmp().

Referenced by load_module(), and reload().

159 {
160  struct ast_config *cfg;
161  struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
162  struct ast_variable *mappingvar;
163  const char *tmp;
164 
165  if ((cfg = ast_config_load(config_file, config_flags)) == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEINVALID) {
166  ast_log(LOG_WARNING, "Failed to %sload configuration file. %s\n",
167  reload ? "re" : "", reload ? "" : "Module not activated.");
168  return -1;
169  } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
170  return 0;
171  }
172 
173  if (reload) {
174  free_config();
175  }
176 
177  if (!(mappingvar = ast_variable_browse(cfg, "master"))) {
178  /* Nothing configured */
179  ast_config_destroy(cfg);
180  return -1;
181  }
182 
183  /* Mapping must have a table name */
184  if (!ast_strlen_zero(tmp = ast_variable_retrieve(cfg, "master", "table"))) {
185  ast_copy_string(table, tmp, sizeof(table));
186  } else {
187  ast_log(LOG_WARNING, "Table name not specified. Assuming cel.\n");
188  strcpy(table, "cel");
189  }
190 
191  /* sqlite3_busy_timeout in miliseconds */
192  if ((tmp = ast_variable_retrieve(cfg, "master", "busy_timeout")) != NULL) {
193  if (ast_parse_arg(tmp, PARSE_INT32|PARSE_DEFAULT, &busy_timeout, 1000) != 0) {
194  ast_log(LOG_WARNING, "Invalid busy_timeout value '%s' specified. Using 1000 instead.\n", tmp);
195  }
196  } else {
197  busy_timeout = 1000;
198  }
199 
200  /* Columns */
201  if (load_column_config(ast_variable_retrieve(cfg, "master", "columns"))) {
202  ast_config_destroy(cfg);
203  free_config();
204  return -1;
205  }
206 
207  /* Values */
208  if (load_values_config(ast_variable_retrieve(cfg, "master", "values"))) {
209  ast_config_destroy(cfg);
210  free_config();
211  return -1;
212  }
213 
214  ast_verb(3, "Logging CEL records to table '%s' in 'master.db'\n", table);
215 
216  ast_config_destroy(cfg);
217 
218  return 0;
219 }
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
Definition: extconf.c:1216
static int reload(void)
#define LOG_WARNING
Definition: logger.h:274
#define CONFIG_STATUS_FILEINVALID
static int tmp()
Definition: bt_open.c:389
Structure for variables, used for configurations and for channel variables.
#define NULL
Definition: resample.c:96
#define ast_verb(level,...)
Definition: logger.h:463
#define ast_strlen_zero(foo)
Definition: strings.h:52
#define ast_log
Definition: astobj2.c:42
#define ast_config_load(filename, flags)
Load a config file.
void ast_config_destroy(struct ast_config *config)
Destroys a config.
Definition: extconf.c:1290
static void free_config(void)
#define CONFIG_STATUS_FILEUNCHANGED
static const char config_file[]
static int load_values_config(const char *tmp)
int ast_parse_arg(const char *arg, enum ast_parse_flags flags, void *result,...)
The argument parsing routine.
Definition: main/config.c:3657
Structure used to handle boolean flags.
Definition: utils.h:199
#define CONFIG_STATUS_FILEMISSING
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
Definition: main/config.c:694
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401
static int busy_timeout
static int load_column_config(const char *tmp)
static char table[80]

◆ load_module()

static int load_module ( void  )
static

Definition at line 300 of file cel_sqlite3_custom.c.

References ast_cel_backend_register(), ast_config_AST_LOG_DIR, ast_log, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, busy_timeout, db, error(), free_config(), load_config(), LOG_ERROR, LOG_WARNING, NULL, PATH_MAX, SQLITE_BACKEND_NAME, table, and write_cel().

Referenced by reload().

301 {
302  char *error;
303  char filename[PATH_MAX];
304  int res;
305  char *sql;
306 
307  if (load_config(0)) {
309  }
310 
311  /* is the database there? */
312  snprintf(filename, sizeof(filename), "%s/master.db", ast_config_AST_LOG_DIR);
313  res = sqlite3_open(filename, &db);
314  if (res != SQLITE_OK) {
315  ast_log(LOG_ERROR, "Could not open database %s.\n", filename);
316  free_config();
318  }
319  sqlite3_busy_timeout(db, busy_timeout);
320  /* is the table there? */
321  sql = sqlite3_mprintf("SELECT COUNT(*) FROM %q;", table);
322  res = sqlite3_exec(db, sql, NULL, NULL, NULL);
323  sqlite3_free(sql);
324  if (res != SQLITE_OK) {
325  /* We don't use %q for the column list here since we already escaped when building it */
326  sql = sqlite3_mprintf("CREATE TABLE %q (AcctId INTEGER PRIMARY KEY, %s)", table, columns);
327  res = sqlite3_exec(db, sql, NULL, NULL, &error);
328  sqlite3_free(sql);
329  if (res != SQLITE_OK) {
330  ast_log(LOG_WARNING, "Unable to create table '%s': %s.\n", table, error);
331  sqlite3_free(error);
332  free_config();
334  }
335  }
336 
338  ast_log(LOG_ERROR, "Unable to register custom SQLite3 CEL handling\n");
339  free_config();
341  }
342 
344 }
static void write_cel(struct ast_event *event)
int ast_cel_backend_register(const char *name, ast_cel_backend_cb backend_callback)
Register a CEL backend.
Definition: cel.c:1740
#define LOG_WARNING
Definition: logger.h:274
#define NULL
Definition: resample.c:96
static int load_config(int reload)
#define ast_log
Definition: astobj2.c:42
static sqlite3 * db
static void free_config(void)
#define LOG_ERROR
Definition: logger.h:285
const char * ast_config_AST_LOG_DIR
Definition: options.c:159
#define SQLITE_BACKEND_NAME
Module has failed to load, may be in an inconsistent state.
Definition: module.h:78
static int busy_timeout
static char table[80]
int error(const char *format,...)
Definition: utils/frame.c:999
#define PATH_MAX
Definition: asterisk.h:40

◆ load_values_config()

static int load_values_config ( const char *  tmp)
static

Definition at line 126 of file cel_sqlite3_custom.c.

References ast_calloc, ast_copy_string(), ast_free, AST_LIST_INSERT_TAIL, ast_log, ast_strdup, ast_strip_quoted(), ast_strlen_zero, values::expression, values::list, LOG_ERROR, LOG_WARNING, NULL, strsep(), and value.

Referenced by load_config().

127 {
128  char *val = NULL;
129  char *vals = NULL, *save = NULL;
130  struct values *value = NULL;
131 
132  if (ast_strlen_zero(tmp)) {
133  ast_log(LOG_WARNING, "Values not specified. Module not loaded.\n");
134  return -1;
135  }
136  if (!(save = vals = ast_strdup(tmp))) {
137  ast_log(LOG_ERROR, "Out of memory creating temporary buffer for value '%s'\n", tmp);
138  return -1;
139  }
140  while ((val = strsep(&vals, ","))) {
141  /* Strip the single quotes off if they are there */
142  val = ast_strip_quoted(val, "'", "'");
143  value = ast_calloc(sizeof(char), sizeof(*value) + strlen(val) + 1);
144  if (!value) {
145  ast_log(LOG_ERROR, "Out of memory creating entry for value '%s'\n", val);
146  ast_free(save);
147  return -1;
148  }
149  value->expression = (char *) value + sizeof(*value);
150  ast_copy_string(value->expression, val, strlen(val) + 1);
152  }
153  ast_free(save);
154 
155  return 0;
156 }
struct values::@101 list
Definition: ast_expr2.c:325
#define LOG_WARNING
Definition: logger.h:274
static int tmp()
Definition: bt_open.c:389
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:243
#define NULL
Definition: resample.c:96
int value
Definition: syslog.c:37
#define ast_strlen_zero(foo)
Definition: strings.h:52
char * ast_strip_quoted(char *s, const char *beg_quotes, const char *end_quotes)
Strip leading/trailing whitespace and quotes from a string.
Definition: main/utils.c:1639
#define ast_log
Definition: astobj2.c:42
char expression[1]
#define LOG_ERROR
Definition: logger.h:285
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
Definition: linkedlists.h:730
#define ast_free(a)
Definition: astmm.h:182
#define ast_calloc(num, len)
A wrapper for calloc()
Definition: astmm.h:204
char * strsep(char **str, const char *delims)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:401

◆ reload()

static int reload ( void  )
static

Definition at line 346 of file cel_sqlite3_custom.c.

References AST_MODFLAG_LOAD_ORDER, AST_MODPRI_CDR_DRIVER, AST_MODULE_INFO(), AST_MODULE_SUPPORT_EXTENDED, ast_mutex_lock, ast_mutex_unlock, ASTERISK_GPL_KEY, load_config(), load_module(), lock, and unload_module().

347 {
348  int res = 0;
349 
351  res = load_config(1);
353 
354  return res;
355 }
#define ast_mutex_lock(a)
Definition: lock.h:187
static int load_config(int reload)
static ast_mutex_t lock
#define ast_mutex_unlock(a)
Definition: lock.h:188

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 291 of file cel_sqlite3_custom.c.

References ast_cel_backend_unregister(), free_config(), and SQLITE_BACKEND_NAME.

Referenced by reload().

292 {
294 
295  free_config();
296 
297  return 0;
298 }
static void free_config(void)
int ast_cel_backend_unregister(const char *name)
Unregister a CEL backend.
Definition: cel.c:1728
#define SQLITE_BACKEND_NAME

◆ write_cel()

static void write_cel ( struct ast_event event)
static

Definition at line 240 of file cel_sqlite3_custom.c.

References ast_cel_fabricate_channel_from_event(), ast_channel_unref, ast_debug, ast_free, AST_LIST_TRAVERSE, ast_log, ast_mutex_lock, ast_mutex_unlock, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_strlen(), db, dummy(), error(), values::expression, values::list, lock, LOG_ERROR, NULL, pbx_substitute_variables_helper(), table, and value.

Referenced by load_module().

241 {
242  char *error = NULL;
243  char *sql = NULL;
244 
245  if (db == NULL) {
246  /* Should not have loaded, but be failsafe. */
247  return;
248  }
249 
251 
252  { /* Make it obvious that only sql should be used outside of this block */
253  char *escaped;
254  char subst_buf[2048];
255  struct values *value;
256  struct ast_channel *dummy;
257  struct ast_str *value_string = ast_str_create(1024);
258 
260  if (!dummy) {
261  ast_log(LOG_ERROR, "Unable to fabricate channel from CEL event.\n");
262  ast_free(value_string);
264  return;
265  }
266  AST_LIST_TRAVERSE(&sql_values, value, list) {
267  pbx_substitute_variables_helper(dummy, value->expression, subst_buf, sizeof(subst_buf) - 1);
268  escaped = sqlite3_mprintf("%q", subst_buf);
269  ast_str_append(&value_string, 0, "%s'%s'", ast_str_strlen(value_string) ? "," : "", escaped);
270  sqlite3_free(escaped);
271  }
272  sql = sqlite3_mprintf("INSERT INTO %q (%s) VALUES (%s)", table, columns, ast_str_buffer(value_string));
273  ast_debug(1, "About to log: %s\n", sql);
274  dummy = ast_channel_unref(dummy);
275  ast_free(value_string);
276  }
277 
278  if (sqlite3_exec(db, sql, NULL, NULL, &error) != SQLITE_OK) {
279  ast_log(LOG_ERROR, "%s. SQL: %s.\n", error, sql);
280  sqlite3_free(error);
281  }
282 
283  if (sql) {
284  sqlite3_free(sql);
285  }
287 
288  return;
289 }
Main Channel structure associated with a channel.
#define ast_channel_unref(c)
Decrease channel reference count.
Definition: channel.h:2981
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Definition: strings.h:714
static void dummy(char *unused,...)
Definition: chan_unistim.c:220
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
Definition: strings.h:1091
#define ast_mutex_lock(a)
Definition: lock.h:187
#define NULL
Definition: resample.c:96
int value
Definition: syslog.c:37
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:452
#define ast_log
Definition: astobj2.c:42
char expression[1]
static sqlite3 * db
#define LOG_ERROR
Definition: logger.h:285
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
Definition: strings.h:584
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:490
#define ast_free(a)
Definition: astmm.h:182
struct ast_channel * ast_cel_fabricate_channel_from_event(const struct ast_event *event)
Create a fake channel from data in a CEL event.
Definition: cel.c:660
static ast_mutex_t lock
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
Definition: strings.h:688
void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
Definition: ael_main.c:211
static char table[80]
int error(const char *format,...)
Definition: utils/frame.c:999
#define ast_str_create(init_len)
Create a malloc&#39;ed dynamic length string.
Definition: strings.h:620
#define ast_mutex_unlock(a)
Definition: lock.h:188

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "SQLite3 Custom CEL Module" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CDR_DRIVER, .requires = "cel", }
static

Definition at line 364 of file cel_sqlite3_custom.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 364 of file cel_sqlite3_custom.c.

◆ busy_timeout

int busy_timeout
static

Definition at line 71 of file cel_sqlite3_custom.c.

Referenced by load_config(), and load_module().

◆ columns

char* columns
static
Bug:
Handling of this var is crash prone on reloads

Definition at line 70 of file cel_sqlite3_custom.c.

◆ config_file

const char config_file[] = "cel_sqlite3_custom.conf"
static

Definition at line 62 of file cel_sqlite3_custom.c.

Referenced by load_config().

◆ db

sqlite3* db = NULL
static

Definition at line 64 of file cel_sqlite3_custom.c.

Referenced by free_config(), load_module(), and write_cel().

◆ lock

ast_mutex_t lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} }
static

Definition at line 60 of file cel_sqlite3_custom.c.

Referenced by reload(), and write_cel().

◆ sql_values

struct sql_values sql_values = { .first = NULL, .last = NULL, .lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } , }
static

◆ table

char table[80]
static

Definition at line 66 of file cel_sqlite3_custom.c.

Referenced by load_column_config(), load_config(), load_module(), and write_cel().