[svn-commits] tilghman: branch tilghman/auto_preload r273713 - in /team/tilghman/auto_prelo...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Jul 2 11:35:45 CDT 2010
Author: tilghman
Date: Fri Jul 2 11:35:41 2010
New Revision: 273713
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=273713
Log:
Initialized merge tracking via "svnmerge" with revisions "1-273702" from
https://origsvn.digium.com/svn/asterisk/trunk
Added:
team/tilghman/auto_preload/configs/res_curl.conf.sample (with props)
Modified:
team/tilghman/auto_preload/ (props changed)
team/tilghman/auto_preload/include/asterisk/config.h
team/tilghman/auto_preload/include/asterisk/module.h
team/tilghman/auto_preload/main/asterisk.c
team/tilghman/auto_preload/main/config.c
team/tilghman/auto_preload/res/res_adsi.c
team/tilghman/auto_preload/res/res_agi.c
team/tilghman/auto_preload/res/res_config_curl.c
team/tilghman/auto_preload/res/res_curl.c
team/tilghman/auto_preload/res/res_odbc.c
Propchange: team/tilghman/auto_preload/
------------------------------------------------------------------------------
automerge = *
Propchange: team/tilghman/auto_preload/
------------------------------------------------------------------------------
automerge-email = tilghman at mail.jeffandtilghman.com
Propchange: team/tilghman/auto_preload/
------------------------------------------------------------------------------
svnmerge-integrated = /trunk:1-273702
Added: team/tilghman/auto_preload/configs/res_curl.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/configs/res_curl.conf.sample?view=auto&rev=273713
==============================================================================
--- team/tilghman/auto_preload/configs/res_curl.conf.sample (added)
+++ team/tilghman/auto_preload/configs/res_curl.conf.sample Fri Jul 2 11:35:41 2010
@@ -1,0 +1,8 @@
+;
+; CURLOPT global settings (mostly set for realtime)
+;
+[globals]
+;proxy=myproxy.example.com
+;proxytype=http
+;proxyport=8001
+;proxyuserpwd=asterisk:asteriskrocks
Propchange: team/tilghman/auto_preload/configs/res_curl.conf.sample
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: team/tilghman/auto_preload/configs/res_curl.conf.sample
------------------------------------------------------------------------------
svn:keywords = 'Date Author Id Revision Yoyo'
Propchange: team/tilghman/auto_preload/configs/res_curl.conf.sample
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: team/tilghman/auto_preload/include/asterisk/config.h
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/include/asterisk/config.h?view=diff&rev=273713&r1=273712&r2=273713
==============================================================================
--- team/tilghman/auto_preload/include/asterisk/config.h (original)
+++ team/tilghman/auto_preload/include/asterisk/config.h Fri Jul 2 11:35:41 2010
@@ -43,6 +43,8 @@
CONFIG_FLAG_FILEUNCHANGED = (1 << 1),
/*! Don't attempt to cache mtime on this config file. */
CONFIG_FLAG_NOCACHE = (1 << 2),
+ /*! Don't attempt to load from realtime (typically called from a realtime driver dependency) */
+ CONFIG_FLAG_NOREALTIME = (1 << 3),
};
#define CONFIG_STATUS_FILEMISSING (void *)0
Modified: team/tilghman/auto_preload/include/asterisk/module.h
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/include/asterisk/module.h?view=diff&rev=273713&r1=273712&r2=273713
==============================================================================
--- team/tilghman/auto_preload/include/asterisk/module.h (original)
+++ team/tilghman/auto_preload/include/asterisk/module.h Fri Jul 2 11:35:41 2010
@@ -191,6 +191,13 @@
AST_MODFLAG_DEFAULT = 0,
AST_MODFLAG_GLOBAL_SYMBOLS = (1 << 0),
AST_MODFLAG_LOAD_ORDER = (1 << 1),
+};
+
+enum ast_module_load_priority {
+ AST_MODPRI_TIMING = 10, /*!< Provides a timing interface */
+ AST_MODPRI_REALTIME_DEPEND = 20, /*!< Dependency for a realtime driver */
+ AST_MODPRI_REALTIME_DRIVER = 30, /*!< A realtime driver, which provides configuration services for other modules */
+ AST_MODPRI_APP_DEPEND = 80, /*!< Dependency for an application */
};
struct ast_module_info {
Modified: team/tilghman/auto_preload/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/main/asterisk.c?view=diff&rev=273713&r1=273712&r2=273713
==============================================================================
--- team/tilghman/auto_preload/main/asterisk.c (original)
+++ team/tilghman/auto_preload/main/asterisk.c Fri Jul 2 11:35:41 2010
@@ -2826,7 +2826,7 @@
struct ast_variable *v;
char *config = DEFAULT_CONFIG_FILE;
char hostname[MAXHOSTNAMELEN] = "";
- struct ast_flags config_flags = { 0 };
+ struct ast_flags config_flags = { CONFIG_FLAG_NOREALTIME };
struct {
unsigned int dbdir:1;
unsigned int keydir:1;
Modified: team/tilghman/auto_preload/main/config.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/main/config.c?view=diff&rev=273713&r1=273712&r2=273713
==============================================================================
--- team/tilghman/auto_preload/main/config.c (original)
+++ team/tilghman/auto_preload/main/config.c Fri Jul 2 11:35:41 2010
@@ -1895,7 +1895,7 @@
struct ast_config *config, *configtmp;
struct ast_variable *v;
char *driver, *table, *database, *stringp, *tmp;
- struct ast_flags flags = { 0 };
+ struct ast_flags flags = { CONFIG_FLAG_NOREALTIME };
clear_config_maps();
@@ -2059,7 +2059,7 @@
cfg->include_level++;
- if (strcmp(filename, extconfig_conf) && strcmp(filename, "asterisk.conf") && config_engine_list) {
+ if (!ast_test_flags(flags, CONFIG_FLAG_NOREALTIME) && config_engine_list) {
struct ast_config_engine *eng;
eng = find_engine(filename, db, sizeof(db), table, sizeof(table));
Modified: team/tilghman/auto_preload/res/res_adsi.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/res/res_adsi.c?view=diff&rev=273713&r1=273712&r2=273713
==============================================================================
--- team/tilghman/auto_preload/res/res_adsi.c (original)
+++ team/tilghman/auto_preload/res/res_adsi.c Fri Jul 2 11:35:41 2010
@@ -1113,8 +1113,9 @@
return -1;
}
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "ADSI Resource",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "ADSI Resource",
.load = load_module,
.unload = unload_module,
.reload = reload,
+ .load_pri = AST_MODPRI_APP_DEPEND,
);
Modified: team/tilghman/auto_preload/res/res_agi.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/res/res_agi.c?view=diff&rev=273713&r1=273712&r2=273713
==============================================================================
--- team/tilghman/auto_preload/res/res_agi.c (original)
+++ team/tilghman/auto_preload/res/res_agi.c Fri Jul 2 11:35:41 2010
@@ -3842,7 +3842,8 @@
return ast_register_application_xml(app, agi_exec);
}
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Asterisk Gateway Interface (AGI)",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Asterisk Gateway Interface (AGI)",
.load = load_module,
.unload = unload_module,
+ .load_pri = AST_MODPRI_APP_DEPEND,
);
Modified: team/tilghman/auto_preload/res/res_config_curl.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/res/res_config_curl.c?view=diff&rev=273713&r1=273712&r2=273713
==============================================================================
--- team/tilghman/auto_preload/res/res_config_curl.c (original)
+++ team/tilghman/auto_preload/res/res_config_curl.c Fri Jul 2 11:35:41 2010
@@ -608,6 +608,37 @@
.require_func = require_curl,
};
+static int reload_module(void)
+{
+ struct ast_flags flags = { CONFIG_FLAG_NOREALTIME };
+ struct ast_config *cfg;
+ struct ast_variable *var;
+
+ if (!(cfg = ast_config_load2("res_curl.conf", flags))) {
+ return 0;
+ } else if (cfg == CONFIG_STATUS_FILEINVALID) {
+ ast_log(LOG_WARNING, "res_curl.conf could not be parsed!\n");
+ return 0;
+ }
+
+ if (!(var = ast_variable_browse(cfg, "globals")) && !(var = ast_variable_browse(cfg, "global")) && !(var = ast_variable_browse(cfg, "general"))) {
+ ast_log(LOG_WARNING, "[globals] not found in res_curl.conf\n");
+ ast_config_destroy(cfg);
+ return 0;
+ }
+
+ for (; var; var = var->next) {
+ if (strncmp(var->name, "CURLOPT(", 8)) {
+ char name[256];
+ snprintf(name, sizeof(name), "CURLOPT(%s)", var->name);
+ pbx_builtin_setvar_helper(NULL, name, var->value);
+ } else {
+ pbx_builtin_setvar_helper(NULL, var->name, var->value);
+ }
+ }
+ ast_config_destroy(cfg);
+}
+
static int unload_module(void)
{
ast_config_engine_deregister(&curl_engine);
@@ -624,9 +655,23 @@
}
}
+ if (!ast_module_check("func_curl.so")) {
+ if (ast_load_resource("func_curl.so") != AST_MODULE_LOAD_SUCCESS) {
+ ast_log(LOG_ERROR, "Cannot load func_curl, so res_config_curl cannot be loaded\n");
+ return AST_MODULE_LOAD_DECLINE;
+ }
+ }
+
+ reload_module();
+
ast_config_engine_register(&curl_engine);
ast_verb(1, "res_config_curl loaded.\n");
return 0;
}
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Realtime Curl configuration");
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Realtime Curl configuration",
+ .load = load_module,
+ .unload = unload_module,
+ .reload = reload_module,
+ .load_pri = AST_MODPRI_REALTIME_DRIVER,
+ );
Modified: team/tilghman/auto_preload/res/res_curl.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/res/res_curl.c?view=diff&rev=273713&r1=273712&r2=273713
==============================================================================
--- team/tilghman/auto_preload/res/res_curl.c (original)
+++ team/tilghman/auto_preload/res/res_curl.c Fri Jul 2 11:35:41 2010
@@ -65,9 +65,13 @@
if (curl_global_init(CURL_GLOBAL_ALL)) {
ast_log(LOG_ERROR, "Unable to initialize the CURL library. Cannot load res_curl\n");
return AST_MODULE_LOAD_DECLINE;
- }
+ }
return res;
}
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "cURL Resource Module");
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "cURL Resource Module",
+ .load = load_module,
+ .unload = unload_module,
+ .load_pri = AST_MODPRI_REALTIME_DEPEND,
+ );
Modified: team/tilghman/auto_preload/res/res_odbc.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/auto_preload/res/res_odbc.c?view=diff&rev=273713&r1=273712&r2=273713
==============================================================================
--- team/tilghman/auto_preload/res/res_odbc.c (original)
+++ team/tilghman/auto_preload/res/res_odbc.c Fri Jul 2 11:35:41 2010
@@ -1683,8 +1683,9 @@
return 0;
}
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "ODBC resource",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "ODBC resource",
.load = load_module,
.unload = unload_module,
.reload = reload,
+ .load_pri = AST_MODULE_PRIORITY_REALTIME_DEPEND,
);
More information about the svn-commits
mailing list