Added a list of run instance parameters to the engine, access from extmodule.
git-svn-id: http://voip.null.ro/svn/yate@1665 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
b2be1f6d13
commit
8c5baef76a
|
@ -207,8 +207,21 @@ timebomb (bool) - Terminate this module instance if a timeout occured<br />
|
|||
reenter (bool) - If this module is allowed to handle messages generated by itself<br />
|
||||
selfwatch (bool) - If this module is allowed to watch messages generated by itself<br />
|
||||
restart (bool) - Restart this global module if it terminates unexpectedly. Must be turned off to allow normal termination<br />
|
||||
runid (readonly) - Get the engine's run identifier<br />
|
||||
nodename (readonly) - Get the server's node name as known by the engine<br />
|
||||
<b>Engine read-only run parameters:</b><br />
|
||||
engine.version (string,readonly) - Version of the engine, like "2.0.1"<br />
|
||||
engine.release (string,readonly) - Release type and number, like "beta2"<br />
|
||||
engine.nodename (string,readonly) - Server's node name as known by the engine<br />
|
||||
engine.runid (int,readonly) - Engine's run identifier<br />
|
||||
engine.configname (string,readonly) - Name of the master configuration<br />
|
||||
engine.sharedpath (string,readonly) - Path to the shared directory<br />
|
||||
engine.configpath (string,readonly) - Path to the program config files directory<br />
|
||||
engine.cfgsuffix (string,readonly) - Suffix of the config files names, normally ".conf"<br />
|
||||
engine.modulepath (string,readonly) - Path to the main modules directory<br />
|
||||
engine.modsuffix (string,readonly) - Suffix of the loadable modules, normally ".yate"<br />
|
||||
engine.logfile (string,readonly) - Name of the log file if in use, empty if not logging<br />
|
||||
engine.clientmode (bool,readonly) - Check if running as a client<br />
|
||||
engine.supervised (bool,readonly) - Check if running under supervisor <br />
|
||||
engine.maxworkers (int,readonly) - Maximum number of message worker threads<br />
|
||||
</p>
|
||||
|
||||
<p><b>Keyword: %%<setlocal</b><br />
|
||||
|
|
|
@ -147,6 +147,7 @@ String Engine::s_cfgsuffix(CFG_SUFFIX);
|
|||
String Engine::s_modpath(MOD_PATH);
|
||||
String Engine::s_modsuffix(DLL_SUFFIX);
|
||||
ObjList Engine::s_extramod;
|
||||
NamedList Engine::s_params("");
|
||||
|
||||
Engine::RunMode Engine::s_mode = Engine::Stopped;
|
||||
Engine* Engine::s_self = 0;
|
||||
|
@ -624,6 +625,20 @@ int Engine::run()
|
|||
s_node = s_cfg.getValue("general","nodename",hostName);
|
||||
s_node.trimBlanks();
|
||||
}
|
||||
s_params.addParam("version",YATE_VERSION);
|
||||
s_params.addParam("release",YATE_STATUS YATE_RELEASE);
|
||||
s_params.addParam("nodename",s_node);
|
||||
s_params.addParam("runid",String(s_runid));
|
||||
s_params.addParam("configname",s_cfgfile);
|
||||
s_params.addParam("sharedpath",s_shrpath);
|
||||
s_params.addParam("configpath",s_cfgpath);
|
||||
s_params.addParam("cfgsuffix",s_cfgsuffix);
|
||||
s_params.addParam("modulepath",s_modpath);
|
||||
s_params.addParam("modsuffix",s_modsuffix);
|
||||
s_params.addParam("logfile",s_logfile);
|
||||
s_params.addParam("clientmode",String::boolText(clientMode()));
|
||||
s_params.addParam("supervised",String::boolText(s_super_handle >= 0));
|
||||
s_params.addParam("maxworkers",String(s_maxworkers));
|
||||
DDebug(DebugAll,"Engine::run()");
|
||||
install(new EngineStatusHandler);
|
||||
extraPath(clientMode() ? "client" : "server");
|
||||
|
|
|
@ -1282,9 +1282,11 @@ bool ExtModReceiver::processLine(const char* line)
|
|||
val = m_selfWatch;
|
||||
ok = true;
|
||||
}
|
||||
else if (id == "nodename") {
|
||||
ok = val.null();
|
||||
val = Engine::nodeName();
|
||||
else if (id.startsWith("engine.")) {
|
||||
// keep the index in substr in sync with length of "engine."
|
||||
const NamedString* param = Engine::runParams().getParam(id.substr(7));
|
||||
ok = val.null() && param;
|
||||
val = param;
|
||||
}
|
||||
else if (id == "runid") {
|
||||
ok = val.null();
|
||||
|
|
|
@ -852,6 +852,13 @@ public:
|
|||
*/
|
||||
static unsigned int runId();
|
||||
|
||||
/**
|
||||
* Get the engine parameters specific to this run.
|
||||
* @return A reference to the list of run specific parameters
|
||||
*/
|
||||
inline static const NamedList& runParams()
|
||||
{ return s_params; }
|
||||
|
||||
/**
|
||||
* Reinitialize the plugins
|
||||
*/
|
||||
|
@ -1008,6 +1015,7 @@ private:
|
|||
static String s_modpath;
|
||||
static String s_modsuffix;
|
||||
static ObjList s_extramod;
|
||||
static NamedList s_params;
|
||||
static int s_haltcode;
|
||||
static RunMode s_mode;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue