Asterisk - The Open Source Telephony Project GIT-master-80b953f
Loading...
Searching...
No Matches
Macros | Functions | Variables
cel_sqlite3_custom.c File Reference

Custom SQLite3 CEL records. More...

#include "asterisk.h"
#include <sqlite3.h>
#include "asterisk/cel.h"
#include "asterisk/module.h"
#include "asterisk/res_cdrel_custom.h"
Include dependency graph for cel_sqlite3_custom.c:

Go to the source code of this file.

Macros

#define CDREL_BACKEND_TYPE   cdrel_backend_db
 
#define CDREL_RECORD_TYPE   cdrel_record_cel
 
#define CONFIG   "cel_sqlite3_custom.conf"
 
#define CUSTOM_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 custom_log (struct ast_event *event)
 
static enum ast_module_load_result load_module (void)
 
static int reload (void)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "SQLite3 Custom CEL Module" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CDR_DRIVER, .requires = "cel,res_cdrel_custom", }
 
static const struct ast_module_infoast_module_info = &__mod_info
 
static struct cdrel_configs * configs
 
static ast_rwlock_t configs_lock
 

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

The logic for this module now resides in res/res_cdrel_custom.c.

Definition in file cel_sqlite3_custom.c.

Macro Definition Documentation

◆ CDREL_BACKEND_TYPE

#define CDREL_BACKEND_TYPE   cdrel_backend_db

Definition at line 61 of file cel_sqlite3_custom.c.

◆ CDREL_RECORD_TYPE

#define CDREL_RECORD_TYPE   cdrel_record_cel

Definition at line 60 of file cel_sqlite3_custom.c.

◆ CONFIG

#define CONFIG   "cel_sqlite3_custom.conf"

Definition at line 49 of file cel_sqlite3_custom.c.

◆ CUSTOM_BACKEND_NAME

#define CUSTOM_BACKEND_NAME   "CEL sqlite3 custom backend"

Definition at line 51 of file cel_sqlite3_custom.c.

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 111 of file cel_sqlite3_custom.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 111 of file cel_sqlite3_custom.c.

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 111 of file cel_sqlite3_custom.c.

◆ custom_log()

static void custom_log ( struct ast_event event)
static

Definition at line 63 of file cel_sqlite3_custom.c.

64{
68}
static ast_rwlock_t configs_lock
#define ast_rwlock_rdlock(a)
Definition lock.h:242
#define ast_rwlock_unlock(a)
Definition lock.h:241
int cdrel_logger(struct cdrel_configs *configs, void *data)
Log a record. The module's logging_cb must call this.
Definition loggers.c:270

References ast_rwlock_rdlock, ast_rwlock_unlock, cdrel_logger(), and configs_lock.

Referenced by load_module().

◆ load_module()

static enum ast_module_load_result load_module ( void  )
static

Definition at line 84 of file cel_sqlite3_custom.c.

85{
86 if (ast_rwlock_init(&configs_lock) != 0) {
88 }
89
91
93}
static void custom_log(struct ast_event *event)
#define CDREL_RECORD_TYPE
#define CONFIG
#define CDREL_BACKEND_TYPE
#define CUSTOM_BACKEND_NAME
#define ast_rwlock_init(rwlock)
wrapper for rwlock with tracking enabled
Definition lock.h:231
@ AST_MODULE_LOAD_SUCCESS
Definition module.h:70
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Definition module.h:78
struct cdrel_configs * cdrel_load_module(enum cdrel_backend_type backend_type, enum cdrel_record_type record_type, const char *config_filename, const char *backend_name, void *logging_cb)
Perform initial module load.

References AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_rwlock_init, CDREL_BACKEND_TYPE, cdrel_load_module(), CDREL_RECORD_TYPE, CONFIG, configs_lock, CUSTOM_BACKEND_NAME, and custom_log().

◆ reload()

static int reload ( void  )
static

Definition at line 95 of file cel_sqlite3_custom.c.

96{
97 int res = 0;
101 return res;
102}
#define ast_rwlock_wrlock(a)
Definition lock.h:243
int cdrel_reload_module(enum cdrel_backend_type backend_type, enum cdrel_record_type record_type, struct cdrel_configs **configs, const char *config_filename)
Perform module reload.

References ast_rwlock_unlock, ast_rwlock_wrlock, CDREL_BACKEND_TYPE, CDREL_RECORD_TYPE, cdrel_reload_module(), CONFIG, and configs_lock.

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 70 of file cel_sqlite3_custom.c.

71{
72 int res = 0;
73
77 if (res == 0) {
79 }
80
81 return res;
82}
#define ast_rwlock_destroy(rwlock)
Definition lock.h:240
int cdrel_unload_module(enum cdrel_backend_type backend_type, enum cdrel_record_type record_type, struct cdrel_configs *configs, const char *backend_name)
Perform module unload.

References ast_rwlock_destroy, ast_rwlock_unlock, ast_rwlock_wrlock, CDREL_BACKEND_TYPE, CDREL_RECORD_TYPE, cdrel_unload_module(), configs_lock, and CUSTOM_BACKEND_NAME.

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "SQLite3 Custom CEL Module" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CDR_DRIVER, .requires = "cel,res_cdrel_custom", }
static

Definition at line 111 of file cel_sqlite3_custom.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 111 of file cel_sqlite3_custom.c.

◆ configs

struct cdrel_configs* configs
static

Definition at line 53 of file cel_sqlite3_custom.c.

◆ configs_lock

ast_rwlock_t configs_lock
static

Protects in-flight log transactions from reloads.

Definition at line 58 of file cel_sqlite3_custom.c.

Referenced by custom_log(), load_module(), reload(), and unload_module().