mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
merge new_loader_completion branch, including (at least):
- restructured build tree and makefiles to eliminate recursion problems - support for embedded modules - support for static builds - simpler cross-compilation support - simpler module/loader interface (no exported symbols) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@40722 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
# the GNU General Public License
|
||||
#
|
||||
|
||||
ifneq ($(wildcard ../menuselect.makeopts),)
|
||||
ifneq ($(wildcard $(ASTTOPDIR)/menuselect.makeopts),)
|
||||
include ../menuselect.makeopts
|
||||
include ../menuselect.makedeps
|
||||
endif
|
||||
@@ -17,7 +17,12 @@ endif
|
||||
C_MODS:=$(filter-out $(MENUSELECT_CDR),$(patsubst %.c,%,$(wildcard cdr_*.c)))
|
||||
CC_MODS:=$(filter-out $(MENUSELECT_CDR),$(patsubst %.cc,%,$(wildcard cdr_*.cc)))
|
||||
|
||||
SELECTED_MODS:=$(C_MODS) $(CC_MODS)
|
||||
LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
|
||||
|
||||
ifneq ($(findstring cdr,$(MENUSELECT_EMBED)),)
|
||||
EMBEDDED_MODS:=$(LOADABLE_MODS)
|
||||
LOADABLE_MODS:=
|
||||
endif
|
||||
|
||||
all: _all
|
||||
|
||||
|
@@ -89,8 +89,6 @@ static char *config = "cdr.conf";
|
||||
"userfield" user field set via SetCDRUserField
|
||||
----------------------------------------------------------*/
|
||||
|
||||
static char *desc = "Comma Separated Values CDR Backend";
|
||||
|
||||
static char *name = "csv";
|
||||
|
||||
static FILE *mf = NULL;
|
||||
@@ -311,12 +309,7 @@ static int csv_log(struct ast_cdr *cdr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *description(void)
|
||||
{
|
||||
return desc;
|
||||
}
|
||||
|
||||
static int unload_module(void *mod)
|
||||
static int unload_module(void)
|
||||
{
|
||||
if (mf)
|
||||
fclose(mf);
|
||||
@@ -324,13 +317,13 @@ static int unload_module(void *mod)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int load_module(void *mod)
|
||||
static int load_module(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
load_config();
|
||||
|
||||
res = ast_cdr_register(name, desc, csv_log);
|
||||
res = ast_cdr_register(name, ast_module_info->description, csv_log);
|
||||
if (res) {
|
||||
ast_log(LOG_ERROR, "Unable to register CSV CDR handling\n");
|
||||
if (mf)
|
||||
@@ -339,15 +332,15 @@ static int load_module(void *mod)
|
||||
return res;
|
||||
}
|
||||
|
||||
static int reload(void *mod)
|
||||
static int reload(void)
|
||||
{
|
||||
load_config();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *key(void)
|
||||
{
|
||||
return ASTERISK_GPL_KEY;
|
||||
}
|
||||
|
||||
STD_MOD(MOD_1 | NO_USECOUNT, reload, NULL, NULL);
|
||||
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Comma Separated Values CDR Backend",
|
||||
.load = load_module,
|
||||
.unload = unload_module,
|
||||
.reload = reload,
|
||||
);
|
||||
|
@@ -57,8 +57,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
|
||||
AST_MUTEX_DEFINE_STATIC(lock);
|
||||
|
||||
static char *desc = "Customizable Comma Separated Values CDR Backend";
|
||||
|
||||
static char *name = "cdr-custom";
|
||||
|
||||
static FILE *mf = NULL;
|
||||
@@ -137,12 +135,7 @@ static int custom_log(struct ast_cdr *cdr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *description(void)
|
||||
{
|
||||
return desc;
|
||||
}
|
||||
|
||||
static int unload_module(void *mod)
|
||||
static int unload_module(void)
|
||||
{
|
||||
if (mf)
|
||||
fclose(mf);
|
||||
@@ -150,12 +143,12 @@ static int unload_module(void *mod)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int load_module(void *mod)
|
||||
static int load_module(void)
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
if (!load_config(0)) {
|
||||
res = ast_cdr_register(name, desc, custom_log);
|
||||
res = ast_cdr_register(name, ast_module_info->description, custom_log);
|
||||
if (res)
|
||||
ast_log(LOG_ERROR, "Unable to register custom CDR handling\n");
|
||||
if (mf)
|
||||
@@ -164,15 +157,14 @@ static int load_module(void *mod)
|
||||
return res;
|
||||
}
|
||||
|
||||
static int reload(void *mod)
|
||||
static int reload(void)
|
||||
{
|
||||
return load_config(1);
|
||||
}
|
||||
|
||||
static const char *key(void)
|
||||
{
|
||||
return ASTERISK_GPL_KEY;
|
||||
}
|
||||
|
||||
STD_MOD(MOD_1 | NO_USECOUNT, reload, NULL, NULL);
|
||||
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Customizable Comma Separated Values CDR Backend",
|
||||
.load = load_module,
|
||||
.unload = unload_module,
|
||||
.reload = reload,
|
||||
);
|
||||
|
||||
|
@@ -45,7 +45,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#define DATE_FORMAT "%Y-%m-%d %T"
|
||||
#define CONF_FILE "cdr_manager.conf"
|
||||
|
||||
static char *desc = "Asterisk Call Manager CDR Backend";
|
||||
static char *name = "cdr_manager";
|
||||
|
||||
static int enablecdr = 0;
|
||||
@@ -135,25 +134,20 @@ static int manager_log(struct ast_cdr *cdr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *description(void)
|
||||
{
|
||||
return desc;
|
||||
}
|
||||
|
||||
static int unload_module(void *mod)
|
||||
static int unload_module(void)
|
||||
{
|
||||
ast_cdr_unregister(name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int load_module(void *mod)
|
||||
static int load_module(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
/* Configuration file */
|
||||
loadconfigurationfile();
|
||||
|
||||
res = ast_cdr_register(name, desc, manager_log);
|
||||
res = ast_cdr_register(name, "Asterisk Manager Interface CDR Backend", manager_log);
|
||||
if (res) {
|
||||
ast_log(LOG_ERROR, "Unable to register Asterisk Call Manager CDR handling\n");
|
||||
}
|
||||
@@ -161,15 +155,14 @@ static int load_module(void *mod)
|
||||
return res;
|
||||
}
|
||||
|
||||
static int reload(void *mod)
|
||||
static int reload(void)
|
||||
{
|
||||
loadconfigurationfile();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *key(void)
|
||||
{
|
||||
return ASTERISK_GPL_KEY;
|
||||
}
|
||||
|
||||
STD_MOD(MOD_1 | NO_USECOUNT, reload, NULL, NULL);
|
||||
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Asterisk Manager Interface CDR Backend",
|
||||
.load = load_module,
|
||||
.unload = unload_module,
|
||||
.reload = reload,
|
||||
);
|
||||
|
@@ -64,7 +64,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
|
||||
#define DATE_FORMAT "%Y-%m-%d %T"
|
||||
|
||||
static char *desc = "ODBC CDR Backend";
|
||||
static char *name = "ODBC";
|
||||
static char *config = "cdr_odbc.conf";
|
||||
static char *dsn = NULL, *username = NULL, *password = NULL, *table = NULL;
|
||||
@@ -207,11 +206,6 @@ static int odbc_log(struct ast_cdr *cdr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *description(void)
|
||||
{
|
||||
return desc;
|
||||
}
|
||||
|
||||
static int odbc_unload_module(void)
|
||||
{
|
||||
ast_mutex_lock(&odbc_lock);
|
||||
@@ -365,7 +359,7 @@ static int odbc_load_module(void)
|
||||
ast_verbose( VERBOSE_PREFIX_3 "cdr_odbc: Unable to connect to datasource: %s\n", dsn);
|
||||
}
|
||||
}
|
||||
res = ast_cdr_register(name, desc, odbc_log);
|
||||
res = ast_cdr_register(name, ast_module_info->description, odbc_log);
|
||||
if (res) {
|
||||
ast_log(LOG_ERROR, "cdr_odbc: Unable to register ODBC CDR handling\n");
|
||||
}
|
||||
@@ -452,25 +446,24 @@ static int odbc_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int load_module(void *mod)
|
||||
static int load_module(void)
|
||||
{
|
||||
return odbc_load_module();
|
||||
}
|
||||
|
||||
static int unload_module(void *mod)
|
||||
static int unload_module(void)
|
||||
{
|
||||
return odbc_unload_module();
|
||||
}
|
||||
|
||||
static int reload(void *mod)
|
||||
static int reload(void)
|
||||
{
|
||||
odbc_unload_module();
|
||||
return odbc_load_module();
|
||||
}
|
||||
|
||||
static const char *key(void)
|
||||
{
|
||||
return ASTERISK_GPL_KEY;
|
||||
}
|
||||
|
||||
STD_MOD(MOD_0, reload, NULL, NULL);
|
||||
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "ODBC CDR Backend",
|
||||
.load = load_module,
|
||||
.unload = unload_module,
|
||||
.reload = reload,
|
||||
);
|
||||
|
@@ -59,7 +59,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
|
||||
#define DATE_FORMAT "%Y-%m-%d %T"
|
||||
|
||||
static char *desc = "PostgreSQL CDR Backend";
|
||||
static char *name = "pgsql";
|
||||
static char *config = "cdr_pgsql.conf";
|
||||
static char *pghostname = NULL, *pgdbname = NULL, *pgdbuser = NULL, *pgpassword = NULL, *pgdbport = NULL, *table = NULL;
|
||||
@@ -179,11 +178,6 @@ static int pgsql_log(struct ast_cdr *cdr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *description(void)
|
||||
{
|
||||
return desc;
|
||||
}
|
||||
|
||||
static int my_unload_module(void)
|
||||
{
|
||||
if (conn)
|
||||
@@ -285,7 +279,7 @@ static int process_my_load_module(struct ast_config *cfg)
|
||||
connected = 0;
|
||||
}
|
||||
|
||||
return ast_cdr_register(name, desc, pgsql_log);
|
||||
return ast_cdr_register(name, ast_module_info->description, pgsql_log);
|
||||
}
|
||||
|
||||
static int my_load_module(void)
|
||||
@@ -304,25 +298,24 @@ static int my_load_module(void)
|
||||
return res;
|
||||
}
|
||||
|
||||
static int load_module(void *mod)
|
||||
static int load_module(void)
|
||||
{
|
||||
return my_load_module();
|
||||
}
|
||||
|
||||
static int unload_module(void *mod)
|
||||
static int unload_module(void)
|
||||
{
|
||||
return my_unload_module();
|
||||
}
|
||||
|
||||
static int reload(void *mod)
|
||||
static int reload(void)
|
||||
{
|
||||
my_unload_module();
|
||||
return my_load_module();
|
||||
}
|
||||
|
||||
static const char *key(void)
|
||||
{
|
||||
return ASTERISK_GPL_KEY;
|
||||
}
|
||||
|
||||
STD_MOD(MOD_0, reload, NULL, NULL);
|
||||
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "PostgreSQL CDR Backend",
|
||||
.load = load_module,
|
||||
.unload = unload_module,
|
||||
.reload = reload,
|
||||
);
|
||||
|
@@ -229,18 +229,13 @@ static int radius_log(struct ast_cdr *cdr)
|
||||
return result;
|
||||
}
|
||||
|
||||
static const char *description(void)
|
||||
{
|
||||
return desc;
|
||||
}
|
||||
|
||||
static int unload_module(void *mod)
|
||||
static int unload_module(void)
|
||||
{
|
||||
ast_cdr_unregister(name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int load_module(void *mod)
|
||||
static int load_module(void)
|
||||
{
|
||||
struct ast_config *cfg;
|
||||
char *tmp;
|
||||
@@ -272,9 +267,4 @@ static int load_module(void *mod)
|
||||
return ast_cdr_register(name, desc, radius_log);
|
||||
}
|
||||
|
||||
static const char *key(void)
|
||||
{
|
||||
return ASTERISK_GPL_KEY;
|
||||
}
|
||||
|
||||
STD_MOD(MOD_0, NULL, NULL, NULL);
|
||||
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "RADIUS CDR Backend");
|
||||
|
@@ -57,7 +57,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
/* When you change the DATE_FORMAT, be sure to change the CHAR(19) below to something else */
|
||||
#define DATE_FORMAT "%Y-%m-%d %T"
|
||||
|
||||
static char *desc = "SQLite CDR Backend";
|
||||
static char *name = "sqlite";
|
||||
static sqlite* db = NULL;
|
||||
|
||||
@@ -166,13 +165,7 @@ static int sqlite_log(struct ast_cdr *cdr)
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static const char *description(void)
|
||||
{
|
||||
return desc;
|
||||
}
|
||||
|
||||
static int unload_module(void *mod)
|
||||
static int unload_module(void)
|
||||
{
|
||||
if (db)
|
||||
sqlite_close(db);
|
||||
@@ -180,7 +173,7 @@ static int unload_module(void *mod)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int load_module(void *mod)
|
||||
static int load_module(void)
|
||||
{
|
||||
char *zErr;
|
||||
char fn[PATH_MAX];
|
||||
@@ -208,7 +201,7 @@ static int load_module(void *mod)
|
||||
/* TODO: here we should probably create an index */
|
||||
}
|
||||
|
||||
res = ast_cdr_register(name, desc, sqlite_log);
|
||||
res = ast_cdr_register(name, ast_module_info->description, sqlite_log);
|
||||
if (res) {
|
||||
ast_log(LOG_ERROR, "Unable to register SQLite CDR handling\n");
|
||||
return -1;
|
||||
@@ -221,14 +214,4 @@ err:
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int reload(void *mod)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *key(void)
|
||||
{
|
||||
return ASTERISK_GPL_KEY;
|
||||
}
|
||||
|
||||
STD_MOD(MOD_0, reload, NULL, NULL);
|
||||
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "SQLite CDR Backend");
|
||||
|
@@ -88,7 +88,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
|
||||
#define DATE_FORMAT "%Y/%m/%d %T"
|
||||
|
||||
static char *desc = "MSSQL CDR Backend";
|
||||
static char *name = "mssql";
|
||||
static char *config = "cdr_tds.conf";
|
||||
|
||||
@@ -297,11 +296,6 @@ static void get_date(char *dateField, struct timeval tv)
|
||||
}
|
||||
}
|
||||
|
||||
static const char *description(void)
|
||||
{
|
||||
return desc;
|
||||
}
|
||||
|
||||
static int mssql_disconnect(void)
|
||||
{
|
||||
if (tds) {
|
||||
@@ -494,7 +488,7 @@ static int tds_load_module(void)
|
||||
mssql_connect();
|
||||
|
||||
/* Register MSSQL CDR handler */
|
||||
res = ast_cdr_register(name, desc, tds_log);
|
||||
res = ast_cdr_register(name, ast_module_info->description, tds_log);
|
||||
if (res)
|
||||
{
|
||||
ast_log(LOG_ERROR, "Unable to register MSSQL CDR handling\n");
|
||||
@@ -503,25 +497,24 @@ static int tds_load_module(void)
|
||||
return res;
|
||||
}
|
||||
|
||||
static int reload(void *mod)
|
||||
static int reload(void)
|
||||
{
|
||||
tds_unload_module();
|
||||
return tds_load_module();
|
||||
}
|
||||
|
||||
static int load_module(void *mod)
|
||||
static int load_module(void)
|
||||
{
|
||||
return tds_load_module();
|
||||
}
|
||||
|
||||
static int unload_module(void *mod)
|
||||
static int unload_module(void)
|
||||
{
|
||||
return tds_unload_module();
|
||||
}
|
||||
|
||||
static const char *key(void)
|
||||
{
|
||||
return ASTERISK_GPL_KEY;
|
||||
}
|
||||
|
||||
STD_MOD(MOD_0, reload, NULL, NULL);
|
||||
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "MSSQL CDR Backend",
|
||||
.load = load_module,
|
||||
.unload = unload_module,
|
||||
.reload = reload,
|
||||
);
|
||||
|
Reference in New Issue
Block a user