changes in SMS drivers and module API (added pointer to server config object in init...
authorVictor Kirhenshtein <victor@netxms.org>
Thu, 25 Feb 2016 15:17:37 +0000 (17:17 +0200)
committerVictor Kirhenshtein <victor@netxms.org>
Thu, 25 Feb 2016 15:17:37 +0000 (17:17 +0200)
15 files changed:
src/server/core/config.cpp
src/server/core/modules.cpp
src/server/core/sms.cpp
src/server/smsdrv/dbemu/main.cpp
src/server/smsdrv/dummy/main.cpp
src/server/smsdrv/generic/.cproject [new file with mode: 0644]
src/server/smsdrv/generic/.project [new file with mode: 0644]
src/server/smsdrv/generic/.settings/language.settings.xml [new file with mode: 0644]
src/server/smsdrv/generic/main.cpp
src/server/smsdrv/kannel/main.cpp
src/server/smsdrv/nxagent/main.cpp
src/server/smsdrv/portech/main.cpp
src/server/smsdrv/slack/main.cpp
src/server/smsdrv/text2reach/main.cpp
src/server/smsdrv/websms/main.cpp

index 93f0e1d..3ee7b62 100644 (file)
@@ -75,6 +75,11 @@ static NX_CFG_TEMPLATE m_cfgTemplate[] =
    { _T(""), CT_END_OF_LIST, 0, 0, 0, 0, NULL, NULL }
 };
 
+/**
+ * Loaded server config
+ */
+Config g_serverConfig;
+
 /**
  * Load and parse configuration file
  * Returns TRUE on success and FALSE on failure
@@ -82,7 +87,6 @@ static NX_CFG_TEMPLATE m_cfgTemplate[] =
 bool NXCORE_EXPORTABLE LoadConfig()
 {
    bool bSuccess = false;
-       Config *config;
 
        if (!_tcscmp(g_szConfigFile, _T("{search}")))
        {
@@ -130,8 +134,7 @@ stop_search:
    if (IsStandalone())
       _tprintf(_T("Using configuration file \"%s\"\n"), g_szConfigFile);
 
-       config = new Config();
-       if (config->loadConfig(g_szConfigFile, _T("server")) && config->parseTemplate(_T("server"), m_cfgTemplate))
+       if (g_serverConfig.loadConfig(g_szConfigFile, _T("server")) && g_serverConfig.parseTemplate(_T("server"), m_cfgTemplate))
    {
       if ((!_tcsicmp(g_szLogFile, _T("{EventLog}"))) ||
           (!_tcsicmp(g_szLogFile, _T("{syslog}"))))
@@ -144,11 +147,9 @@ stop_search:
       }
       bSuccess = true;
    }
-       delete config;
 
        // Decrypt password
    DecryptPassword(g_szDbLogin, g_szDbPassword, g_szDbPassword, MAX_PASSWORD);
-
    return bSuccess;
 }
 
index 287d85e..4b4f0ad 100644 (file)
@@ -1,6 +1,6 @@
 /* 
 ** NetXMS - Network Management System
-** Copyright (C) 2003-2013 Victor Kirhenshtein
+** Copyright (C) 2003-2016 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 
 #include "nxcore.h"
 
+/**
+ * Server config
+ */
+extern Config g_serverConfig;
+
 /**
  * List of loaded modules
  */
@@ -65,20 +70,19 @@ static bool LoadNetXMSModule(const TCHAR *name)
 
    if (hModule != NULL)
    {
-      BOOL (* ModuleInit)(NXMODULE *);
+      bool (* ModuleInit)(NXMODULE *, Config *);
 
-      ModuleInit = (BOOL (*)(NXMODULE *))DLGetSymbolAddr(hModule, "NetXMSModuleInit", szErrorText);
+      ModuleInit = (bool (*)(NXMODULE *, Config *))DLGetSymbolAddr(hModule, "NetXMSModuleInit", szErrorText);
       if (ModuleInit != NULL)
       {
          NXMODULE module;
          memset(&module, 0, sizeof(NXMODULE));
-         if (ModuleInit(&module))
+         if (ModuleInit(&module, &g_serverConfig))
          {
             if (module.dwSize == sizeof(NXMODULE))
             {
                // Add module to module's list
-               g_pModuleList = (NXMODULE *)realloc(g_pModuleList, 
-                                                   sizeof(NXMODULE) * (g_dwNumModules + 1));
+               g_pModuleList = (NXMODULE *)realloc(g_pModuleList, sizeof(NXMODULE) * (g_dwNumModules + 1));
                memcpy(&g_pModuleList[g_dwNumModules], &module, sizeof(NXMODULE));
                g_pModuleList[g_dwNumModules].hModule = hModule;
 
index b9f3775..640d12e 100644 (file)
@@ -1,6 +1,6 @@
 /*
 ** NetXMS - Network Management System
-** Copyright (C) 2003-2014 Victor Kirhenshtein
+** Copyright (C) 2003-2016 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 
 #include "nxcore.h"
 
+/**
+ * Server config
+ */
+extern Config g_serverConfig;
+
 /**
  * SMS structure
  */
@@ -34,10 +39,10 @@ typedef struct
 /**
  * Static data
  */
-static Queue *m_pMsgQueue = NULL;
-static BOOL (* m_DrvSendMsg)(const TCHAR *, const TCHAR *);
-static void (* m_DrvUnload)();
-static THREAD m_hThread = INVALID_THREAD_HANDLE;
+static Queue s_smsQueue;
+static bool (* s_fpDrvSendMsg)(const TCHAR *, const TCHAR *);
+static void (* s_fpDrvUnload)();
+static THREAD s_senderThread = INVALID_THREAD_HANDLE;
 
 /**
  * Sender thread
@@ -48,7 +53,7 @@ static THREAD_RESULT THREAD_CALL SenderThread(void *pArg)
 
    while(1)
    {
-      pMsg = (SMS *)m_pMsgQueue->getOrBlock();
+      pMsg = (SMS *)s_smsQueue.getOrBlock();
       if (pMsg == INVALID_POINTER_VALUE)
          break;
 
@@ -56,7 +61,7 @@ static THREAD_RESULT THREAD_CALL SenderThread(void *pArg)
                int tries = 3;
                do
                {
-                       if (m_DrvSendMsg(pMsg->szRcpt, pMsg->szText))
+                       if (s_fpDrvSendMsg(pMsg->szRcpt, pMsg->szText))
                                break;
                        DbgPrintf(3, _T("Failed to send SMS (will%s retry)"), (tries > 1) ? _T("") : _T(" not"));
                }
@@ -90,18 +95,16 @@ void InitSMSSender()
       hModule = DLOpen(szDriver, szErrorText);
       if (hModule != NULL)
       {
-         BOOL (* DrvInit)(const TCHAR *);
+         bool (* DrvInit)(const TCHAR *, Config *);
 
-         DrvInit = (BOOL (*)(const TCHAR *))DLGetSymbolAddr(hModule, "SMSDriverInit", szErrorText);
-         m_DrvSendMsg = (BOOL (*)(const TCHAR *, const TCHAR *))DLGetSymbolAddr(hModule, "SMSDriverSend", szErrorText);
-         m_DrvUnload = (void (*)())DLGetSymbolAddr(hModule, "SMSDriverUnload", szErrorText);
-         if ((DrvInit != NULL) && (m_DrvSendMsg != NULL) && (m_DrvUnload != NULL))
+         DrvInit = (bool (*)(const TCHAR *, Config *))DLGetSymbolAddr(hModule, "SMSDriverInit", szErrorText);
+         s_fpDrvSendMsg = (bool (*)(const TCHAR *, const TCHAR *))DLGetSymbolAddr(hModule, "SMSDriverSend", szErrorText);
+         s_fpDrvUnload = (void (*)())DLGetSymbolAddr(hModule, "SMSDriverUnload", szErrorText);
+         if ((DrvInit != NULL) && (s_fpDrvSendMsg != NULL) && (s_fpDrvUnload != NULL))
          {
-            if (DrvInit(szDrvConfig))
+            if (DrvInit(szDrvConfig, &g_serverConfig))
             {
-               m_pMsgQueue = new Queue;
-
-               m_hThread = ThreadCreateEx(SenderThread, 0, NULL);
+               s_senderThread = ThreadCreateEx(SenderThread, 0, NULL);
             }
             else
             {
@@ -127,14 +130,10 @@ void InitSMSSender()
  */
 void ShutdownSMSSender()
 {
-   if (m_pMsgQueue != NULL)
-   {
-      m_pMsgQueue->clear();
-      m_pMsgQueue->put(INVALID_POINTER_VALUE);
-      if (m_hThread != INVALID_THREAD_HANDLE)
-         ThreadJoin(m_hThread);
-      delete m_pMsgQueue;
-   }
+   s_smsQueue.clear();
+   s_smsQueue.put(INVALID_POINTER_VALUE);
+   if (s_senderThread != INVALID_THREAD_HANDLE)
+      ThreadJoin(s_senderThread);
 }
 
 /**
@@ -142,11 +141,8 @@ void ShutdownSMSSender()
  */
 void NXCORE_EXPORTABLE PostSMS(const TCHAR *pszRcpt, const TCHAR *pszText)
 {
-       if (m_pMsgQueue == NULL)
-      return;
-
        SMS *pMsg = (SMS *)malloc(sizeof(SMS));
        nx_strncpy(pMsg->szRcpt, pszRcpt, MAX_RCPT_ADDR_LEN);
        nx_strncpy(pMsg->szText, pszText, 160);
-       m_pMsgQueue->put(pMsg);
+       s_smsQueue.put(pMsg);
 }
index b9447c6..d7188a7 100644 (file)
@@ -33,9 +33,9 @@ static TCHAR s_sqlTemplate[1024];
 static DB_DRIVER s_driver;
 static DB_HANDLE s_dbh;
 
-extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *pszInitArgs)
+extern "C" bool EXPORT SMSDriverInit(const TCHAR *pszInitArgs, Config *config)
 {
-       BOOL bRet = false;
+       bool bRet = false;
        static NX_CFG_TEMPLATE configTemplate[] = 
        {
                { _T("DBDriver"), CT_STRING, 0, 0, sizeof(s_dbDriver) / sizeof(TCHAR), 0, s_dbDriver }, 
@@ -48,22 +48,7 @@ extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *pszInitArgs)
                { _T(""), CT_END_OF_LIST, 0, 0, 0, 0, NULL }
        };
 
-       const TCHAR *configFile;
-       if (pszInitArgs == NULL || *pszInitArgs == 0)
-       {
-#ifdef _WIN32
-               configFile = _T("C:\\smsdbemu.conf");
-#else
-               configFile = _T("/etc/smsdbemu.conf");
-#endif
-       }
-       else
-       {
-               configFile = pszInitArgs;
-       }
-
-       Config *config = new Config();
-       if (config->loadIniConfig(configFile, _T("SMSDbEmu")) && config->parseTemplate(_T("SMSDbEmu"), configTemplate))
+       if (config->parseTemplate(_T("SMSDbEmu"), configTemplate))
        {
                s_driver = DBLoadDriver(s_dbDriver, NULL, TRUE, NULL, NULL);
                if (s_driver == NULL)
@@ -87,9 +72,9 @@ finish:
        return bRet;
 }
 
-extern "C" BOOL EXPORT SMSDriverSend(const TCHAR *pszPhoneNumber, const TCHAR *pszText)
+extern "C" bool EXPORT SMSDriverSend(const TCHAR *pszPhoneNumber, const TCHAR *pszText)
 {
-       BOOL bRet = false;
+       bool bRet = false;
 
        if (s_dbh == NULL)
        {
index 1fb7270..2311b39 100644 (file)
 /**
  * Init driver
  */
-extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *pszInitArgs)
+extern "C" bool EXPORT SMSDriverInit(const TCHAR *pszInitArgs, Config *config)
 {
        DbgPrintf(1, _T("Dummy SMS Driver loaded, set debug=6 or higher to see actual messages"));
-       return TRUE;
+       return true;
 }
 
 /**
  * Send SMS
  */
-extern "C" BOOL EXPORT SMSDriverSend(const TCHAR *pszPhoneNumber, const TCHAR *pszText)
+extern "C" bool EXPORT SMSDriverSend(const TCHAR *pszPhoneNumber, const TCHAR *pszText)
 {
-       DbgPrintf(6, _T("DummySMS: phone=\"%s\", text=\"%s\""), pszPhoneNumber, pszText);
-   return TRUE;
+   DbgPrintf(6, _T("DummySMS: phone=\"%s\", text=\"%s\""), pszPhoneNumber, pszText);
+   return true;
 }
 
 /**
diff --git a/src/server/smsdrv/generic/.cproject b/src/server/smsdrv/generic/.cproject
new file mode 100644 (file)
index 0000000..d06c7e6
--- /dev/null
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+       <storageModule moduleId="org.eclipse.cdt.core.settings">
+               <cconfiguration id="cdt.managedbuild.toolchain.gnu.base.1190365515">
+                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.base.1190365515" moduleId="org.eclipse.cdt.core.settings" name="Default">
+                               <externalSettings/>
+                               <extensions>
+                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+                               </extensions>
+                       </storageModule>
+                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                               <configuration artifactName="${ProjName}" buildProperties="" description="" id="cdt.managedbuild.toolchain.gnu.base.1190365515" name="Default" parent="org.eclipse.cdt.build.core.emptycfg">
+                                       <folderInfo id="cdt.managedbuild.toolchain.gnu.base.1190365515.6825447" name="/" resourcePath="">
+                                               <toolChain id="cdt.managedbuild.toolchain.gnu.base.2092090440" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
+                                                       <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.168666924" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
+                                                       <builder id="cdt.managedbuild.target.gnu.builder.base.1149472018" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.target.gnu.builder.base"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.archiver.base.260013722" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.1998098737" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
+                                                               <option id="gnu.cpp.compiler.option.include.paths.1745121553" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${NETXMS_BASE}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${NETXMS_BASE}/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${NETXMS_BASE}/src/server/include&quot;"/>
+                                                               </option>
+                                                               <option id="gnu.cpp.compiler.option.preprocessor.def.212020682" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" valueType="definedSymbols">
+                                                                       <listOptionValue builtIn="false" value="_THREAD_SAFE"/>
+                                                                       <listOptionValue builtIn="false" value="TRE_WCHAR=1"/>
+                                                                       <listOptionValue builtIn="false" value="UNICODE"/>
+                                                                       <listOptionValue builtIn="false" value="_GNU_SOURCE"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.993109407" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.c.compiler.base.1005331636" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base">
+                                                               <option id="gnu.c.compiler.option.include.paths.2106570135" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${NETXMS_BASE}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${NETXMS_BASE}/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${NETXMS_BASE}/src/server/include&quot;"/>
+                                                               </option>
+                                                               <option id="gnu.c.compiler.option.preprocessor.def.symbols.623517614" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols">
+                                                                       <listOptionValue builtIn="false" value="_THREAD_SAFE"/>
+                                                                       <listOptionValue builtIn="false" value="TRE_WCHAR=1"/>
+                                                                       <listOptionValue builtIn="false" value="UNICODE"/>
+                                                                       <listOptionValue builtIn="false" value="_GNU_SOURCE"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.410526379" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.c.linker.base.999629495" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.2127809963" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base">
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1233255772" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+                                                                       <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+                                                                       <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+                                                               </inputType>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.assembler.base.271249980" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base">
+                                                               <option id="gnu.both.asm.option.include.paths.540645842" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
+                                                                       <listOptionValue builtIn="false" value="&quot;${NETXMS_BASE}&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${NETXMS_BASE}/include&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;${NETXMS_BASE}/src/server/include&quot;"/>
+                                                               </option>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1851447612" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+                                                       </tool>
+                                               </toolChain>
+                                       </folderInfo>
+                               </configuration>
+                       </storageModule>
+                       <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+               </cconfiguration>
+       </storageModule>
+       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+               <project id="generic.null.480815018" name="generic"/>
+       </storageModule>
+       <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+       <storageModule moduleId="scannerConfiguration">
+               <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+               <scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.base.1190365515;cdt.managedbuild.toolchain.gnu.base.1190365515.6825447;cdt.managedbuild.tool.gnu.cpp.compiler.base.1998098737;cdt.managedbuild.tool.gnu.cpp.compiler.input.993109407">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+               </scannerConfigBuildInfo>
+               <scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.base.1190365515;cdt.managedbuild.toolchain.gnu.base.1190365515.6825447;cdt.managedbuild.tool.gnu.c.compiler.base.1005331636;cdt.managedbuild.tool.gnu.c.compiler.input.410526379">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+               </scannerConfigBuildInfo>
+       </storageModule>
+</cproject>
diff --git a/src/server/smsdrv/generic/.project b/src/server/smsdrv/generic/.project
new file mode 100644 (file)
index 0000000..acc3326
--- /dev/null
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>generic</name>
+       <comment></comment>
+       <projects>
+               <project>libnetxms</project>
+               <project>libnxsrv</project>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+                       <triggers>clean,full,incremental,</triggers>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+                       <triggers>full,incremental,</triggers>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.cdt.core.cnature</nature>
+               <nature>org.eclipse.cdt.core.ccnature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+       </natures>
+       <filteredResources>
+               <filter>
+                       <id>1456411814821</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-*.o</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1456411814823</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-*.lo</arguments>
+                       </matcher>
+               </filter>
+               <filter>
+                       <id>1456411814825</id>
+                       <name></name>
+                       <type>6</type>
+                       <matcher>
+                               <id>org.eclipse.ui.ide.multiFilter</id>
+                               <arguments>1.0-name-matches-false-false-*.la</arguments>
+                       </matcher>
+               </filter>
+       </filteredResources>
+</projectDescription>
diff --git a/src/server/smsdrv/generic/.settings/language.settings.xml b/src/server/smsdrv/generic/.settings/language.settings.xml
new file mode 100644 (file)
index 0000000..3c40688
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<project>
+       <configuration id="cdt.managedbuild.toolchain.gnu.base.1190365515" name="Default">
+               <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
+                       <provider class="org.eclipse.cdt.core.language.settings.providers.LanguageSettingsGenericProvider" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider" name="CDT User Setting Entries" prefer-non-shared="true"/>
+                       <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
+                       <provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
+                       <provider-reference id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" ref="shared-provider"/>
+                       <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
+               </extension>
+       </configuration>
+</project>
index b18f898..6e493f0 100644 (file)
@@ -1,7 +1,7 @@
 /* 
 ** NetXMS - Network Management System
 ** Generic SMS driver
-** Copyright (C) 2003-2014 Raden Solutions
+** Copyright (C) 2003-2016 Raden Solutions
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -97,7 +97,7 @@ static bool InitModem(Serial *serial)
  *
  * pszInitArgs format: portname,speed,databits,parity,stopbits
  */
-extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *pszInitArgs)
+extern "C" bool EXPORT SMSDriverInit(const TCHAR *pszInitArgs, Config *config)
 {
        TCHAR *portName;
        
@@ -235,25 +235,25 @@ extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *pszInitArgs)
 cleanup:
        safe_free(portName);
    s_serial.close();
-       return TRUE;   // return TRUE always to keep driver in memory
+       return true;   // return TRUE always to keep driver in memory
 }
 
 /**
  * Send SMS
  */
-extern "C" BOOL EXPORT SMSDriverSend(const TCHAR *pszPhoneNumber, const TCHAR *pszText)
+extern "C" bool EXPORT SMSDriverSend(const TCHAR *pszPhoneNumber, const TCHAR *pszText)
 {
        if ((pszPhoneNumber == NULL) || (pszText == NULL))
-      return FALSE;
+      return false;
 
    DbgPrintf(3, _T("SMS: send to {%s}: {%s}"), pszPhoneNumber, pszText);
    if (!s_serial.restart())
    {
        DbgPrintf(5, _T("SMS: failed to open port"));
-      return FALSE;
+      return false;
    }
 
-   BOOL success = FALSE;
+   bool success = false;
    if (!InitModem(&s_serial))
       goto cleanup;
        
@@ -346,7 +346,7 @@ extern "C" BOOL EXPORT SMSDriverSend(const TCHAR *pszPhoneNumber, const TCHAR *p
       goto cleanup;
 
    DbgPrintf(5, _T("SMS: AT+CMGS + message body sent, got OK"));
-   success = TRUE;
+   success = true;
 
 cleanup:
    s_serial.setTimeout(2000);
index b7458ed..616df95 100644 (file)
@@ -1,7 +1,7 @@
 /* 
 ** NetXMS - Network Management System
 ** SMS driver for Kannel gateway
-** Copyright (C) 2014 Raden Solutions
+** Copyright (C) 2014-2016 Raden Solutions
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -58,12 +58,12 @@ static char s_password[128] = "password";
 /**
  * Init driver
  */
-extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *initArgs)
+extern "C" bool EXPORT SMSDriverInit(const TCHAR *initArgs, Config *config)
 {
    if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
    {
       DbgPrintf(1, _T("Kannel: cURL initialization failed"));
-      return FALSE;
+      return false;
    }
 
    DbgPrintf(1, _T("Kannel: driver loaded"));
@@ -94,7 +94,7 @@ extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *initArgs)
    ExtractNamedOptionValueA(realInitArgs, "login", s_login, 128);
    ExtractNamedOptionValueA(realInitArgs, "password", s_password, 128);
 
-       return TRUE;
+   return true;
 }
 
 /**
@@ -123,11 +123,11 @@ static size_t OnCurlDataReceived(char *ptr, size_t size, size_t nmemb, void *use
 /**
  * Send SMS
  */
-extern "C" BOOL EXPORT SMSDriverSend(const TCHAR *phoneNumber, const TCHAR *text)
+extern "C" bool EXPORT SMSDriverSend(const TCHAR *phoneNumber, const TCHAR *text)
 {
-   BOOL success = FALSE;
+   bool success = false;
 
-       DbgPrintf(4, _T("Kannel: phone=\"%s\", text=\"%s\""), phoneNumber, text);
+   DbgPrintf(4, _T("Kannel: phone=\"%s\", text=\"%s\""), phoneNumber, text);
 
    CURL *curl = curl_easy_init();
    if (curl != NULL)
@@ -176,7 +176,7 @@ extern "C" BOOL EXPORT SMSDriverSend(const TCHAR *phoneNumber, const TCHAR *text
             DbgPrintf(4, _T("Kannel: response code %03d"), (int)response);
             if (response == 202)
             {
-               success = TRUE;
+               success = true;
             }
          }
          else
index 9915448..5a280bd 100644 (file)
@@ -1,6 +1,6 @@
 /* 
 ** SMS Driver for sending SMS via NetXMS agent
-** Copyright (C) 2007-2015 Victor Kirhenshtein
+** Copyright (C) 2007-2016 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@ static UINT32 m_timeout = 30000;      // Default timeout is 30 seconds
  * Initialize driver
  * pszInitArgs format: hostname,port,timeout,secret
  */
-extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *pszInitArgs)
+extern "C" bool EXPORT SMSDriverInit(const TCHAR *pszInitArgs, Config *config)
 {
        TCHAR *temp, *ptr, *eptr;
        int field;
@@ -70,15 +70,15 @@ extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *pszInitArgs)
       }
    }
        free(temp);
-       return TRUE;
+       return true;
 }
 
 /**
  * Send SMS
  */
-extern "C" BOOL EXPORT SMSDriverSend(const TCHAR *pszPhoneNumber, const TCHAR *pszText)
+extern "C" bool EXPORT SMSDriverSend(const TCHAR *pszPhoneNumber, const TCHAR *pszText)
 {
-       BOOL bSuccess = FALSE;
+       bool bSuccess = false;
 
    InetAddress addr = InetAddress::resolveHostName(m_hostName);
    if (addr.isValid())
@@ -92,7 +92,7 @@ extern "C" BOOL EXPORT SMSDriverSend(const TCHAR *pszPhoneNumber, const TCHAR *p
                        argv[0] = (TCHAR *)pszPhoneNumber;
                        argv[1] = (TCHAR *)pszText;
          if (conn->execAction(_T("SMS.Send"), 2, argv) == ERR_SUCCESS)
-                               bSuccess = TRUE;
+                               bSuccess = true;
                }
       conn->decRefCount();
        }
index 5e6c015..c7d7f42 100644 (file)
@@ -1,7 +1,7 @@
 /* 
 ** NetXMS - Network Management System
 ** SMS driver for Portech MV-37x VoIP GSM gateways
-** Copyright (C) 2011-2013 Victor Kirhenshtein
+** Copyright (C) 2011-2016 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -44,7 +44,7 @@ static enum { OM_TEXT, OM_PDU } s_mode = OM_PDU;
  * option string format: option1=value1;option2=value2;...
  * Valid options are: host, login, password, mode
  */
-extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *options)
+extern "C" bool EXPORT SMSDriverInit(const TCHAR *options, Config *config)
 {
        DbgPrintf(1, _T("Loading Portech MV-72x SMS Driver (configuration: %s)"), options);
 
@@ -77,11 +77,11 @@ extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *options)
                else
                {
                        nxlog_write(MSG_SMSDRV_INVALID_OPTION, NXLOG_ERROR, "s", _T("mode"));
-                       return FALSE;
+                       return false;
                }
        }
        
-       return TRUE;
+       return true;
 }
 
 /**
@@ -128,12 +128,12 @@ static void DoLogout(SocketConnection *conn)
 /**
  * Return immediately if given operation failed
  */
-#define __chk(x) if (!(x)) { return FALSE; }
+#define __chk(x) if (!(x)) { return false; }
 
 /**
  * Send SMS in text mode
  */
-static BOOL SendText(SocketConnection *conn, const TCHAR *pszPhoneNumber, const TCHAR *pszText)
+static bool SendText(SocketConnection *conn, const TCHAR *pszPhoneNumber, const TCHAR *pszText)
 {
        char szTmp[128];
        
@@ -177,13 +177,13 @@ static BOOL SendText(SocketConnection *conn, const TCHAR *pszPhoneNumber, const
        __chk(conn->waitForText("OK", 5000));
        DbgPrintf(4, _T("SMS sent successfully"));
 
-       return TRUE;
+       return true;
 }
 
 /**
  * Send SMS in PDU mode
  */
-static BOOL SendPDU(SocketConnection *conn, const TCHAR *pszPhoneNumber, const TCHAR *pszText)
+static bool SendPDU(SocketConnection *conn, const TCHAR *pszPhoneNumber, const TCHAR *pszText)
 {
        const int bufferSize = 512;
        char szTmp[bufferSize];
@@ -196,7 +196,7 @@ static BOOL SendPDU(SocketConnection *conn, const TCHAR *pszPhoneNumber, const T
            WideCharToMultiByte(CP_ACP, WC_DEFAULTCHAR | WC_COMPOSITECHECK, pszText, -1, text, bufferSize, NULL, NULL) == 0)
        {
                DbgPrintf(2, _T("SMS: Failed to convert phone number or text to multibyte string"));
-               return FALSE;
+               return false;
        }
 #else
        nx_strncpy(phoneNumber, pszPhoneNumber, bufferSize);
@@ -231,19 +231,19 @@ static BOOL SendPDU(SocketConnection *conn, const TCHAR *pszPhoneNumber, const T
        __chk(conn->waitForText("OK", 2000));
        DbgPrintf(4, _T("SMS sent successfully"));
 
-       return TRUE;
+       return true;
 }
 
 /**
  * Send SMS
  */
-extern "C" BOOL EXPORT SMSDriverSend(const TCHAR *pszPhoneNumber, const TCHAR *pszText)
+extern "C" bool EXPORT SMSDriverSend(const TCHAR *pszPhoneNumber, const TCHAR *pszText)
 {
        SocketConnection *conn;
-       BOOL success = FALSE;
+       bool success = false;
 
        if ((pszPhoneNumber == NULL) || (pszText == NULL))
-               return FALSE;
+               return false;
 
    bool canRetry = true;
 
index ffe1e45..f2d2148 100644 (file)
@@ -1,7 +1,7 @@
 /* 
 ** NetXMS - Network Management System
 ** SMS driver for slack.com service
-** Copyright (C) 2014 Raden Solutions
+** Copyright (C) 2014-2016 Raden Solutions
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -57,12 +57,12 @@ static char s_url[1024] = "";
 /**
  * Init driver
  */
-extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *initArgs)
+extern "C" bool EXPORT SMSDriverInit(const TCHAR *initArgs, Config *config)
 {
    if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
    {
       DbgPrintf(1, _T("Slack: cURL initialization failed"));
-      return FALSE;
+      return false;
    }
 
    DbgPrintf(1, _T("Slack: driver loaded"));
@@ -93,7 +93,7 @@ extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *initArgs)
    ExtractNamedOptionValue(initArgs, _T("username"), s_username, 64);
 #endif
 
-       return TRUE;
+       return true;
 }
 
 /**
@@ -122,9 +122,9 @@ static size_t OnCurlDataReceived(char *ptr, size_t size, size_t nmemb, void *use
 /**
  * Send SMS
  */
-extern "C" BOOL EXPORT SMSDriverSend(const TCHAR *channel, const TCHAR *text)
+extern "C" bool EXPORT SMSDriverSend(const TCHAR *channel, const TCHAR *text)
 {
-   BOOL success = FALSE;
+   bool success = false;
 
        DbgPrintf(4, _T("Slack: channel=\"%s\", text=\"%s\""), channel, text);
 
@@ -185,7 +185,7 @@ extern "C" BOOL EXPORT SMSDriverSend(const TCHAR *channel, const TCHAR *text)
                if (!strcmp(data->data, "ok"))
                {
                   DbgPrintf(4, _T("Slack: message successfully sent"));
-                  success = TRUE;
+                  success = true;
                }
                else
                {
index f3c6eba..9510f1d 100644 (file)
@@ -1,7 +1,7 @@
 /* 
 ** NetXMS - Network Management System
 ** SMS driver for Text2Reach.com service
-** Copyright (C) 2014 Raden Solutions
+** Copyright (C) 2014-2016 Raden Solutions
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU Lesser General Public License as published by
@@ -56,12 +56,12 @@ static char s_from[128] = "from";
 /**
  * Init driver
  */
-extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *initArgs)
+extern "C" bool EXPORT SMSDriverInit(const TCHAR *initArgs, Config *config)
 {
    if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
    {
       DbgPrintf(1, _T("Text2Reach: cURL initialization failed"));
-      return FALSE;
+      return false;
    }
 
    DbgPrintf(1, _T("Text2Reach: driver loaded"));
@@ -92,7 +92,7 @@ extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *initArgs)
    ExtractNamedOptionValue(initArgs, _T("from"), s_from, 128);
 #endif
 
-       return TRUE;
+       return true;
 }
 
 /**
@@ -121,9 +121,9 @@ static size_t OnCurlDataReceived(char *ptr, size_t size, size_t nmemb, void *use
 /**
  * Send SMS
  */
-extern "C" BOOL EXPORT SMSDriverSend(const TCHAR *phoneNumber, const TCHAR *text)
+extern "C" bool EXPORT SMSDriverSend(const TCHAR *phoneNumber, const TCHAR *text)
 {
-   BOOL success = FALSE;
+   bool success = false;
 
    DbgPrintf(4, _T("Text2Reach: phone=\"%s\", text=\"%s\""), phoneNumber, text);
        
@@ -168,7 +168,7 @@ extern "C" BOOL EXPORT SMSDriverSend(const TCHAR *phoneNumber, const TCHAR *text
                        if (response == 200)
                        {
                                DbgPrintf(4, _T("Text2Reach: SMS successfully sent"));
-                               success = TRUE;
+                               success = true;
                        }
                        else
                        {
index 7f1f5a1..be51bfc 100644 (file)
@@ -57,12 +57,12 @@ static char s_fromPhone[64] = "";
 /**
  * Init driver
  */
-extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *initArgs)
+extern "C" bool EXPORT SMSDriverInit(const TCHAR *initArgs, Config *config)
 {
    if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
    {
       DbgPrintf(1, _T("WebSMS: cURL initialization failed"));
-      return FALSE;
+      return false;
    }
 
    DbgPrintf(1, _T("WebSMS: driver loaded"));
@@ -97,7 +97,7 @@ extern "C" BOOL EXPORT SMSDriverInit(const TCHAR *initArgs)
    ExtractNamedOptionValue(initArgs, _T("fromPhone"), s_fromPhone, 64);
 #endif
 
-       return TRUE;
+       return true;
 }
 
 /**
@@ -126,9 +126,9 @@ static size_t OnCurlDataReceived(char *ptr, size_t size, size_t nmemb, void *use
 /**
  * Send SMS
  */
-extern "C" BOOL EXPORT SMSDriverSend(const TCHAR *phoneNumber, const TCHAR *text)
+extern "C" bool EXPORT SMSDriverSend(const TCHAR *phoneNumber, const TCHAR *text)
 {
-   BOOL success = FALSE;
+   bool success = false;
 
        DbgPrintf(4, _T("WebSMS: phone=\"%s\", text=\"%s\""), phoneNumber, text);