Module: sems Branch: master Commit: 32db165d114a00df235dc01f903b4be2c4630858 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=32db165d114a00df235dc01f903b4be2c4630858
Author: Raphael Coeffic <[email protected]> Committer: Raphael Coeffic <[email protected]> Date: Tue Sep 20 15:51:14 2011 +0200 added dedicated function for reading plug-in configuration file. --- core/AmConfigReader.cpp | 6 ++++++ core/AmConfigReader.h | 4 ++++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/core/AmConfigReader.cpp b/core/AmConfigReader.cpp index b2691e2..c79cbc1 100644 --- a/core/AmConfigReader.cpp +++ b/core/AmConfigReader.cpp @@ -181,6 +181,12 @@ int AmConfigReader::loadFile(const string& path) return -1; } +int AmConfigReader::loadPluginConf(const string& mod_name) +{ + return loadFile(add2path(AmConfig::ModConfigPath,1, + string(mod_name + CONFIG_FILE_SUFFIX).c_str())); +} + bool AmConfigReader::getMD5(const string& path, string& md5hash, bool lowercase) { std::ifstream data_file(path.c_str(), std::ios::in | std::ios::binary); if (!data_file) { diff --git a/core/AmConfigReader.h b/core/AmConfigReader.h index ec36288..2af36d3 100644 --- a/core/AmConfigReader.h +++ b/core/AmConfigReader.h @@ -34,6 +34,8 @@ using std::string; #define MAX_CONFIG_LINE 2048 +#define CONFIG_FILE_SUFFIX ".conf" + /** * \brief configuration file reader * @@ -48,6 +50,8 @@ class AmConfigReader public: int loadFile(const string& path); + int loadPluginConf(const string& mod_name); + /** get md5 hash of file contents */ bool getMD5(const string& path, string& md5hash, bool lowercase = true); void setParameter(const string& param, const string& val); _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
