Further non-Unicode fixes; LoraWAN subagent refactoring
authorEriks Jenkevics <eriks@netxms.org>
Wed, 16 Aug 2017 14:19:41 +0000 (17:19 +0300)
committerEriks Jenkevics <eriks@netxms.org>
Wed, 16 Aug 2017 14:19:41 +0000 (17:19 +0300)
13 files changed:
include/nms_agent.h
src/agent/libnxagent/Makefile.am
src/agent/libnxagent/lora_device_data.cpp [new file with mode: 0644]
src/agent/subagents/lorawan/commproc.cpp
src/agent/subagents/lorawan/lorawan.h
src/agent/subagents/lorawan/lslink.cpp
src/agent/subagents/lorawan/main.cpp
src/agent/subagents/nas/.cproject [deleted file]
src/agent/subagents/nas/.settings/org.eclipse.cdt.codan.core.prefs [deleted file]
src/agent/subagents/nas/Makefile.am [deleted file]
src/agent/subagents/nas/decoder.cpp [deleted file]
src/agent/subagents/nas/main.cpp [deleted file]
src/agent/subagents/nas/nas.h [deleted file]

index 62cc6aa..022bff4 100644 (file)
@@ -834,42 +834,41 @@ public:
    LoraDeviceData(NXCPMessage *request);
    LoraDeviceData(DB_RESULT result, int row);
 
-   UINT32 saveDeviceData();
-   UINT32 updateDeviceData();
-   UINT32 deleteDeviceData();
+   UINT32 saveToDB (bool isNew = false) const;
+   UINT32 deleteFromDB () const;
 
-   bool isOtaa() { return (m_devEui.length() > 0) ? true : false; }
+   bool isOtaa() const { return (m_devEui.length() > 0) ? true : false; }
 
-   uuid getGuid() { return m_guid; }
+   const uuid& getGuid() const { return m_guid; }
 
-   MacAddress getDevAddr() { return m_devAddr; }
-   void setDevAddr(MacAddress devAddr) { m_devAddr = devAddr; updateDeviceData(); }
-   MacAddress getDevEui() { return m_devEui; }
+   const MacAddress& getDevAddr() const { return m_devAddr; }
+   void setDevAddr(MacAddress devAddr) { m_devAddr = devAddr; saveToDB(); }
+   const MacAddress& getDevEui() const { return m_devEui; }
 
-   const BYTE *getPayload() { return m_payload; }
+   const BYTE *getPayload() const { return m_payload; }
    void setPayload(const char *payload) {  StrToBinA(payload, m_payload, 36); }
 
    UINT32 getDecoder() { return m_decoder; }
 
-   const char *getDataRate() { return m_dataRate; }
+   const char *getDataRate() const { return m_dataRate; }
    void setDataRate(const char *dataRate) { strncpy(m_dataRate, dataRate, 24); }
 
-   INT32 getRssi() { return m_rssi; }
+   INT32 getRssi() const { return m_rssi; }
    void setRssi(INT32 rssi) { m_rssi = rssi; }
 
-   double getSnr() { return m_snr; }
+   double getSnr() const { return m_snr; }
    void setSnr(double snr) { m_snr = snr; }
 
-   double getFreq() { return m_freq; }
+   double getFreq() const { return m_freq; }
    void setFreq(double freq) { m_freq = freq; }
 
-   UINT32 getFcnt() { return m_fcnt; }
+   UINT32 getFcnt() const { return m_fcnt; }
    void setFcnt(UINT32 fcnt) { m_fcnt = fcnt; }
 
-   UINT32 getPort() { return m_port; }
+   UINT32 getPort() const { return m_port; }
    void setPort(UINT32 port) { m_port = port; }
 
-   const INT32 getLastContact() { return (INT32)m_lastContact; }
+   INT32 getLastContact() const { return (INT32)m_lastContact; }
    void updateLastContact() { m_lastContact = time(NULL); }
 };
 
index 9c6c74e..d7f6803 100644 (file)
@@ -1,4 +1,4 @@
-SOURCES = bridge.cpp cmdexec.cpp dfile_info.cpp main.cpp registry.cpp tools.cpp
+SOURCES = bridge.cpp cmdexec.cpp dfile_info.cpp lora_device_data.cpp main.cpp registry.cpp tools.cpp
 
 lib_LTLIBRARIES = libnxagent.la
 
diff --git a/src/agent/libnxagent/lora_device_data.cpp b/src/agent/libnxagent/lora_device_data.cpp
new file mode 100644 (file)
index 0000000..6d7e011
--- /dev/null
@@ -0,0 +1,127 @@
+/*
+** NetXMS - Network Management System
+** Copyright (C) 2003-2017 Raden Solutions
+**
+** 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
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+** File: lora_device_data.cpp
+**
+**/
+
+#include "libnxagent.h"
+
+/**
+ * Create new Lora Device Data object from NXCPMessage
+ */
+LoraDeviceData::LoraDeviceData(NXCPMessage *request)
+{
+   m_guid = request->getFieldAsGUID(VID_GUID);
+   if (request->getFieldAsUInt32(VID_REG_TYPE) == 0) // OTAA
+      m_devEui = request->getFieldAsMacAddress(VID_MAC_ADDR);
+   else
+   {
+      char devAddr[12];
+      request->getFieldAsMBString(VID_DEVICE_ADDRESS, devAddr, 12);
+      m_devAddr = MacAddress::parse(devAddr);
+   }
+
+   memset(m_payload, 0, 36);
+   m_decoder = request->getFieldAsInt32(VID_DECODER);
+   m_dataRate[0] = 0;
+   m_rssi = 1;
+   m_snr = -100;
+   m_freq = 0;
+   m_fcnt = 0;
+   m_port = 0;
+   m_lastContact = 0;
+}
+
+/**
+ * Create Lora Device Data object from DB record
+ */
+LoraDeviceData::LoraDeviceData(DB_RESULT result, int row)
+{
+   m_guid = DBGetFieldGUID(result, row, 0);
+   m_devAddr = DBGetFieldMacAddr(result, row, 1);
+   m_devEui = DBGetFieldMacAddr(result, row, 2);
+   m_decoder = DBGetFieldULong(result, row, 3);
+   m_lastContact = DBGetFieldULong(result, row, 4);
+
+   memset(m_payload, 0, 36);
+   m_dataRate[0] = 0;
+   m_rssi = 0;
+   m_snr = -100;
+   m_freq = 0;
+   m_fcnt = 0;
+   m_port = 0;
+}
+
+/**
+ * Update Lora device data object in DB
+ */
+UINT32 LoraDeviceData::saveToDB(bool isNew) const
+{
+   UINT32 rcc = ERR_IO_FAILURE;
+
+      DB_HANDLE hdb = AgentGetLocalDatabaseHandle();
+      DB_STATEMENT hStmt;
+      if (isNew)
+         hStmt = DBPrepare(hdb, _T("INSERT INTO device_decoder_map(devAddr,devEui,decoder,last_contact,guid) VALUES (?,?,?,?,?)"));
+      else
+         hStmt = DBPrepare(hdb, _T("UPDATE device_decoder_map SET devAddr=?,devEui=?,decoder=?,last_contact=? WHERE guid=?"));
+
+      if (hStmt != NULL)
+      {
+         DBBind(hStmt, 1, DB_SQLTYPE_VARCHAR, m_devAddr.length() > 0 ? (const TCHAR*)m_devAddr.toString(MAC_ADDR_FLAT_STRING) : _T(""), DB_BIND_STATIC);
+         DBBind(hStmt, 2, DB_SQLTYPE_VARCHAR, m_devEui.length() > 0 ? (const TCHAR*)m_devEui.toString(MAC_ADDR_FLAT_STRING) : _T(""), DB_BIND_STATIC);
+         DBBind(hStmt, 3, DB_SQLTYPE_INTEGER, m_decoder);
+         DBBind(hStmt, 4, DB_SQLTYPE_INTEGER, (UINT32)m_lastContact);
+         DBBind(hStmt, 5, DB_SQLTYPE_VARCHAR, m_guid);
+         if (DBExecute(hStmt))
+            rcc = ERR_SUCCESS;
+         else
+            rcc = ERR_EXEC_FAILED;
+
+         DBFreeStatement(hStmt);
+      }
+      DBConnectionPoolReleaseConnection(hdb);
+
+      return rcc;
+}
+
+/**
+ * Remove device from local map and DB
+ */
+UINT32 LoraDeviceData::deleteFromDB() const
+{
+   UINT32 rcc = ERR_IO_FAILURE;
+
+   DB_HANDLE hdb = AgentGetLocalDatabaseHandle();
+   DB_STATEMENT hStmt = DBPrepare(hdb, _T("DELETE FROM device_decoder_map WHERE guid=?"));
+
+   if (hStmt != NULL)
+   {
+      DBBind(hStmt, 1, DB_SQLTYPE_VARCHAR, m_guid);
+      if (DBExecute(hStmt))
+         rcc = ERR_SUCCESS;
+      else
+         rcc = ERR_EXEC_FAILED;
+
+      DBFreeStatement(hStmt);
+   }
+   DBConnectionPoolReleaseConnection(hdb);
+
+   return rcc;
+}
index 2dbe590..c9a2243 100644 (file)
 #include "lorawan.h"
 
 /**
- * Create new Lora Device Data object from NXCPMessage
- */
-LoraDeviceData::LoraDeviceData(NXCPMessage *request)
-{
-   m_guid = request->getFieldAsGUID(VID_GUID);
-   if (request->getFieldAsUInt32(VID_REG_TYPE) == 0) // OTAA
-      m_devEui = request->getFieldAsMacAddress(VID_MAC_ADDR);
-   else
-   {
-      char devAddr[12];
-      request->getFieldAsMBString(VID_DEVICE_ADDRESS, devAddr, 12);
-      m_devAddr = MacAddress::parse(devAddr);
-   }
-
-   memset(m_payload, 0, 36);
-   m_decoder = request->getFieldAsInt32(VID_DECODER);
-   m_dataRate[0] = 0;
-   m_rssi = 1;
-   m_snr = -100;
-   m_freq = 0;
-   m_fcnt = 0;
-   m_port = 0;
-   m_lastContact = 0;
-}
-
-/**
- * Create Lora Device Data object from DB record
- */
-LoraDeviceData::LoraDeviceData(DB_RESULT result, int row)
-{
-   m_guid = DBGetFieldGUID(result, row, 0);
-   m_devAddr = DBGetFieldMacAddr(result, row, 1);
-   m_devEui = DBGetFieldMacAddr(result, row, 2);
-   m_decoder = DBGetFieldULong(result, row, 3);
-   m_lastContact = DBGetFieldULong(result, row, 4);
-
-   memset(m_payload, 0, 36);
-   m_dataRate[0] = 0;
-   m_rssi = 0;
-   m_snr = -100;
-   m_freq = 0;
-   m_fcnt = 0;
-   m_port = 0;
-}
-
-/**
- * Update Lora device data object in DB
- */
-UINT32 LoraDeviceData::updateDeviceData()
-{
-   UINT32 rcc = ERR_IO_FAILURE;
-
-      DB_HANDLE hdb = AgentGetLocalDatabaseHandle();
-      DB_STATEMENT hStmt;
-      if (FindDevice(m_guid) == NULL)
-         hStmt = DBPrepare(hdb, _T("INSERT INTO device_decoder_map(devAddr,devEui,decoder,last_contact,guid) VALUES (?,?,?,?,?)"));
-      else
-         hStmt = DBPrepare(hdb, _T("UPDATE device_decoder_map SET devAddr=?,devEui=?,decoder=?,last_contact=? WHERE guid=?"));
-
-      if (hStmt != NULL)
-      {
-         DBBind(hStmt, 1, DB_SQLTYPE_VARCHAR, m_devAddr.length() > 0 ? (const TCHAR*)m_devAddr.toString(MAC_ADDR_FLAT_STRING) : _T(""), DB_BIND_STATIC);
-         DBBind(hStmt, 2, DB_SQLTYPE_VARCHAR, m_devEui.length() > 0 ? (const TCHAR*)m_devEui.toString(MAC_ADDR_FLAT_STRING) : _T(""), DB_BIND_STATIC);
-         DBBind(hStmt, 3, DB_SQLTYPE_INTEGER, m_decoder);
-         DBBind(hStmt, 4, DB_SQLTYPE_INTEGER, (UINT32)m_lastContact);
-         DBBind(hStmt, 5, DB_SQLTYPE_VARCHAR, m_guid);
-         if (DBExecute(hStmt))
-            rcc = ERR_SUCCESS;
-         else
-            rcc = ERR_EXEC_FAILED;
-
-         DBFreeStatement(hStmt);
-      }
-      DBConnectionPoolReleaseConnection(hdb);
-
-      return rcc;
-}
-
-/**
- * Save new device in the database and local map
- */
-UINT32 LoraDeviceData::saveDeviceData()
-{
-   UINT32 rcc = updateDeviceData();
-
-   if (rcc == ERR_SUCCESS)
-   {
-      MutexLock(g_deviceMapMutex);
-      g_deviceMap.set(m_guid, this);
-      MutexUnlock(g_deviceMapMutex);
-   }
-
-   return rcc;
-}
-
-/**
- * Remove device from local map and DB
- */
-UINT32 LoraDeviceData::deleteDeviceData()
-{
-   UINT32 rcc = ERR_IO_FAILURE;
-
-   DB_HANDLE hdb = AgentGetLocalDatabaseHandle();
-   DB_STATEMENT hStmt = DBPrepare(hdb, _T("DELETE FROM device_decoder_map WHERE guid=?"));
-
-   if (hStmt != NULL)
-   {
-      DBBind(hStmt, 1, DB_SQLTYPE_VARCHAR, m_guid);
-      if (DBExecute(hStmt))
-      {
-         MutexLock(g_deviceMapMutex);
-         g_deviceMap.remove(m_guid);
-         MutexUnlock(g_deviceMapMutex);
-
-         rcc = ERR_SUCCESS;
-      }
-      else
-         rcc = ERR_EXEC_FAILED;
-
-      DBFreeStatement(hStmt);
-   }
-   DBConnectionPoolReleaseConnection(hdb);
-
-   return rcc;
-}
-
-/**
  * MQTT Mesage handler
  */
 void MqttMessageHandler(const char *payload, char *topic)
index 7d95544..102d317 100644 (file)
@@ -114,5 +114,5 @@ LONG H_Communication(const TCHAR *param, const TCHAR *arg, TCHAR *value, Abstrac
  * Device map functions
  */
 UINT32 AddDevice(LoraDeviceData *data);
-UINT32 RemoveDevice(uuid guid);
+UINT32 RemoveDevice(LoraDeviceData *data);
 LoraDeviceData *FindDevice(uuid guid);
index b4e7d8d..fa5d941 100644 (file)
@@ -39,8 +39,8 @@ LoraWanServerLink::LoraWanServerLink(const ConfigEntry *config)
    m_pass = strdup(config->getSubEntryValue("Password", 0, "admin"));
    m_url =  strdup(config->getSubEntryValue("URL", 0, "http://localhost"));
    m_app = strdup(config->getSubEntryValue("Application", 0, "backend"));
-   m_appId = strdup(config->getSubEntryValue("ApplicationId", 0, L"LoraWAN Devices"));
-   m_region = strdup(config->getSubEntryValue("Region", 0, L"EU863-870"));
+   m_appId = strdup(config->getSubEntryValue("ApplicationId", 0, "LoraWAN Devices"));
+   m_region = strdup(config->getSubEntryValue("Region", 0, "EU863-870"));
 #endif
    m_adr = config->getSubEntryValueAsBoolean(_T("ADR"), 0, true);
    m_fcntCheck = config->getSubEntryValueAsUInt(_T("FcntCheck"), 0, 3);
@@ -194,7 +194,7 @@ UINT32 LoraWanServerLink::registerDevice(NXCPMessage *request)
       if (m_response == 204)
       {
          nxlog_debug(4, _T("LoraWAN Module: New LoraWAN device successfully registered"));
-         rcc = data->saveDeviceData();
+         rcc = AddDevice(data);
       }
       else
       {
@@ -222,11 +222,16 @@ UINT32 LoraWanServerLink::deleteDevice(uuid guid)
       return rcc;
 
    char url[MAX_PATH];
-   char addr[24];
+   char *addr = NULL;
    if (data->isOtaa())  // if OTAA
    {
-      WideCharToMultiByte(CP_UTF8, 0, (const TCHAR*)data->getDevEui().toString(MAC_ADDR_FLAT_STRING), -1, addr, 24, NULL, NULL);
+#ifdef UNICODE
+      addr = UTF8StringFromWideString((const TCHAR*)data->getDevEui().toString(MAC_ADDR_FLAT_STRING));
       snprintf(url, MAX_PATH, "%s/devices/%s", m_url, addr);
+      free(addr);
+#else
+      snprintf(url, MAX_PATH, "%s/devices/%s", m_url, (const TCHAR*)data->getDevEui().toString(MAC_ADDR_FLAT_STRING));
+#endif
       if (sendRequest("DELETE", url) == CURLE_OK)
       {
          curl_easy_getinfo(m_curl, CURLINFO_RESPONSE_CODE, &m_response);
@@ -243,8 +248,13 @@ UINT32 LoraWanServerLink::deleteDevice(uuid guid)
    }
    if (data->getDevAddr().length() != 0)
    {
-      WideCharToMultiByte(CP_UTF8, 0, (const TCHAR *)data->getDevAddr().toString(MAC_ADDR_FLAT_STRING), -1, addr, 24, NULL, NULL);
+#ifdef UNICODE
+      addr = UTF8StringFromWideString((const TCHAR *)data->getDevAddr().toString(MAC_ADDR_FLAT_STRING));
       snprintf(url, MAX_PATH, "%s/nodes/%s", m_url, addr);
+      free(addr);
+#else
+      snprintf(url, MAX_PATH, "%s/nodes/%s", m_url, (const TCHAR *)data->getDevAddr().toString(MAC_ADDR_FLAT_STRING));
+#endif
       struct curl_slist *headers = NULL;
       headers = curl_slist_append(headers, "Accept: application/json");
       char *responseData;
@@ -272,7 +282,7 @@ UINT32 LoraWanServerLink::deleteDevice(uuid guid)
       free(responseData);
    }
    if (m_response == 204)
-      rcc = data->deleteDeviceData();
+      rcc = RemoveDevice(data);
 
    return rcc;
 }
index 12aff96..d338a25 100644 (file)
@@ -55,6 +55,40 @@ static NETXMS_SUBAGENT_PARAM m_parameters[] =
 };
 
 /**
+ * Add LoraDeviceData object to DB and local hashmap
+ */
+UINT32 AddDevice(LoraDeviceData *device)
+{
+   UINT32 rcc = device->saveToDB(true);
+
+   if (rcc == ERR_SUCCESS)
+   {
+      MutexLock(g_deviceMapMutex);
+      g_deviceMap.set(device->getGuid(), device);
+      MutexUnlock(g_deviceMapMutex);
+   }
+
+   return rcc;
+}
+
+/**
+ * Remove LoraDeviceData object from DB and local hashmap
+ */
+UINT32 RemoveDevice(LoraDeviceData *device)
+{
+   UINT32 rcc = device->deleteFromDB();
+
+   if (rcc == ERR_SUCCESS)
+   {
+      MutexLock(g_deviceMapMutex);
+      g_deviceMap.remove(device->getGuid());
+      MutexUnlock(g_deviceMapMutex);
+   }
+
+   return rcc;
+}
+
+/**
  * Find device in local map
  */
 LoraDeviceData *FindDevice(uuid guid)
diff --git a/src/agent/subagents/nas/.cproject b/src/agent/subagents/nas/.cproject
deleted file mode 100644 (file)
index 547329f..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<?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="org.eclipse.linuxtools.cdt.autotools.core.toolChain.497658611">
-                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.497658611" moduleId="org.eclipse.cdt.core.settings" name="Build (GNU)">
-                               <externalSettings/>
-                               <extensions>
-                                       <extension id="org.eclipse.cdt.core.MachO64" point="org.eclipse.cdt.core.BinaryParser"/>
-                                       <extension id="org.eclipse.cdt.core.Cygwin_PE" point="org.eclipse.cdt.core.BinaryParser"/>
-                                       <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
-                                       <extension id="org.eclipse.cdt.core.GNU_ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-                                       <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
-                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
-                               </extensions>
-                       </storageModule>
-                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
-                               <configuration buildProperties="" description="" id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.497658611" name="Build (GNU)" parent="org.eclipse.cdt.build.core.emptycfg">
-                                       <folderInfo id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.497658611.1903778165" name="/" resourcePath="">
-                                               <toolChain id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.988512789" name="GNU Autotools Toolchain" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolChain">
-                                                       <targetPlatform id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform.1901799413" isAbstract="false" name="GNU Autotools Target Platform" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform"/>
-                                                       <builder id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder.1327956954" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Autotools Makefile Generator" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder"/>
-                                                       <tool id="org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure.1450797606" name="configure" superClass="org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure">
-                                                               <option id="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name.1075684483" superClass="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name" value="org.eclipse.linuxtools.cdt.autotools.core.toolChain.497658611" valueType="string"/>
-                                                       </tool>
-                                                       <tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.autogen.163275505" name="autogen.sh" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.autogen"/>
-                                                       <tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.943604297" name="GCC C Compiler" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc">
-                                                               <option id="gnu.c.compiler.option.include.paths.2045040845" 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/agent&quot;"/>
-                                                               </option>
-                                                               <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.758145295" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
-                                                       </tool>
-                                                       <tool id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp.1918719895" name="GCC C++ Compiler" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp">
-                                                               <option id="gnu.cpp.compiler.option.include.paths.7996259" 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/agent&quot;"/>
-                                                               </option>
-                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.112877841" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
-                                                       </tool>
-                                               </toolChain>
-                                       </folderInfo>
-                               </configuration>
-                       </storageModule>
-                       <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
-               </cconfiguration>
-       </storageModule>
-       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
-               <project id="nas.null.660617191" name="nas"/>
-       </storageModule>
-       <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
-       <storageModule moduleId="refreshScope"/>
-       <storageModule moduleId="scannerConfiguration">
-               <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-               <scannerConfigBuildInfo instanceId="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1470884232;org.eclipse.linuxtools.cdt.autotools.core.toolChain.1470884232.1364879027;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp.1187539074;cdt.managedbuild.tool.gnu.cpp.compiler.input.591641913">
-                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-               </scannerConfigBuildInfo>
-               <scannerConfigBuildInfo instanceId="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1470884232;org.eclipse.linuxtools.cdt.autotools.core.toolChain.1470884232.1364879027;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.1167159969;cdt.managedbuild.tool.gnu.c.compiler.input.1326545146">
-                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-               </scannerConfigBuildInfo>
-               <scannerConfigBuildInfo instanceId="org.eclipse.linuxtools.cdt.autotools.core.toolChain.497658611;org.eclipse.linuxtools.cdt.autotools.core.toolChain.497658611.1903778165;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gcc.943604297;cdt.managedbuild.tool.gnu.c.compiler.input.758145295">
-                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-               </scannerConfigBuildInfo>
-               <scannerConfigBuildInfo instanceId="org.eclipse.linuxtools.cdt.autotools.core.toolChain.497658611;org.eclipse.linuxtools.cdt.autotools.core.toolChain.497658611.1903778165;org.eclipse.linuxtools.cdt.autotools.core.toolchain.tool.gpp.1918719895;cdt.managedbuild.tool.gnu.cpp.compiler.input.112877841">
-                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
-               </scannerConfigBuildInfo>
-       </storageModule>
-</cproject>
diff --git a/src/agent/subagents/nas/.settings/org.eclipse.cdt.codan.core.prefs b/src/agent/subagents/nas/.settings/org.eclipse.cdt.codan.core.prefs
deleted file mode 100644 (file)
index 812e407..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.cdt.codan.checkers.errnoreturn=Warning
-org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return\\")",implicit\=>false}
-org.eclipse.cdt.codan.checkers.errreturnvalue=Error
-org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused return value\\")"}
-org.eclipse.cdt.codan.checkers.nocommentinside=-Error
-org.eclipse.cdt.codan.checkers.nocommentinside.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Nesting comments\\")"}
-org.eclipse.cdt.codan.checkers.nolinecomment=-Error
-org.eclipse.cdt.codan.checkers.nolinecomment.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Line comments\\")"}
-org.eclipse.cdt.codan.checkers.noreturn=Error
-org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return value\\")",implicit\=>false}
-org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
-org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Abstract class cannot be instantiated\\")"}
-org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
-org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Ambiguous problem\\")"}
-org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment in condition\\")"}
-org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
-org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment to itself\\")"}
-org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No break at end of case\\")",no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false,enable_fallthrough_quickfix_param\=>false}
-org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
-org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Catching by reference is recommended\\")",unknown\=>false,exceptions\=>()}
-org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
-org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Circular inheritance\\")"}
-org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning
-org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class members should be properly initialized\\")",skip\=>true}
-org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
-org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Field cannot be resolved\\")"}
-org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
-org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Function cannot be resolved\\")"}
-org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
-org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid arguments\\")"}
-org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
-org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid template argument\\")"}
-org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
-org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Label statement not found\\")"}
-org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
-org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Member declaration not found\\")"}
-org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error
-org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Method cannot be resolved\\")"}
-org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
-org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Name convention for function\\")",pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
-org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class has a virtual method and non-virtual destructor\\")"}
-org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
-org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid overload\\")"}
-org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
-org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redeclaration\\")"}
-org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
-org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redefinition\\")"}
-org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
-org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Return with parenthesis\\")"}
-org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
-org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Format String Vulnerability\\")"}
-org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Statement has no effect\\")",macro\=>true,exceptions\=>()}
-org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suggested parenthesis around expression\\")",paramNot\=>false}
-org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suspicious semicolon\\")",else\=>false,afterelse\=>false}
-org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
-org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Type cannot be resolved\\")"}
-org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused function declaration\\")",macro\=>true}
-org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused static function\\")",macro\=>true}
-org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
-org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused variable declaration in file scope\\")",macro\=>true,exceptions\=>("@(\#)","$Id")}
-org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error
-org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Symbol is not resolved\\")"}
diff --git a/src/agent/subagents/nas/Makefile.am b/src/agent/subagents/nas/Makefile.am
deleted file mode 100644 (file)
index 2bd9b10..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-SUBAGENT = nas
-
-pkglib_LTLIBRARIES = nas.la
-nas_la_SOURCES = main.cpp decoder.cpp
-nas_la_CPPFLAGS=-I@top_srcdir@/include
-nas_la_LDFLAGS = -module -avoid-version -export-symbols ../subagent.sym
-nas_la_LIBADD = ../../libnxagent/libnxagent.la ../../../libnetxms/libnetxms.la ../../../libnxmb/libnxmb.la
-
-EXTRA_DIST = nas.h
-
-if !STATIC_BUILD
-install-exec-hook:
-       if test "x`uname -s`" = "xAIX" ; then OBJECT_MODE=@OBJECT_MODE@ $(AR) x $(DESTDIR)$(pkglibdir)/$(SUBAGENT).a $(DESTDIR)$(pkglibdir)/$(SUBAGENT)@SHLIB_SUFFIX@ ; rm -f $(DESTDIR)$(pkglibdir)/$(SUBAGENT).a ; fi
-       mv -f $(DESTDIR)$(pkglibdir)/$(SUBAGENT)@SHLIB_SUFFIX@ $(DESTDIR)$(pkglibdir)/$(SUBAGENT).nsm
-       rm -f $(DESTDIR)$(pkglibdir)/$(SUBAGENT).la
-       rm -f $(DESTDIR)$(libdir)/libnsm_$(SUBAGENT)@SHLIB_SUFFIX@
-       ln -s netxms/$(SUBAGENT).nsm $(DESTDIR)$(libdir)/libnsm_$(SUBAGENT)@SHLIB_SUFFIX@
-endif
diff --git a/src/agent/subagents/nas/decoder.cpp b/src/agent/subagents/nas/decoder.cpp
deleted file mode 100644 (file)
index 62d4f00..0000000
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- ** NAS Smart water meter retrofit decoder for LoraWAN subagent
- ** Copyright (C) 2009 - 2017 Raden Solutions
- **
- ** 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
- ** the Free Software Foundation; either version 2 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program; if not, write to the Free Software
- ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- **
- **/
-
-#include "nas.h"
-
-/**
- * Calculates the battery voltage from the given offset
- */
-static double CalculateBatteryVoltage(int offset)
-{
-   return 3.6 - max(0, (254 - offset - max(0, 16 - offset) - max(0, 245 - offset - max(0, 16 - offset)))) * 0.05 - max(0, 245 - offset - max(0, 16 - offset)) * 0.004 - max(0, 16 - offset) * 0.05;
-}
-
-/**
- * Parses the received payload
- */
-static void ParsePayload(SensorData *sData, const lorawan_payload_t payload, UINT32 fieldId)
-{
-   switch(fieldId)
-   {
-      case SENSOR_COUNTER32:
-      {
-         UINT32 valueInt32;
-         memcpy(&valueInt32, payload, 4);
-#if WORDS_BIGENDIAN
-         valueInt32 = bswap_32(valueInt32);
-#endif
-         UINT32 msw = (UINT32)(sData->counter >> 32);
-         sData->counter = (((UINT64)msw << 32) | valueInt32);
-      }
-         break;
-      case SENSOR_COUNTER64:
-         memcpy(&sData->counter, payload, 8);
-#if WORDS_BIGENDIAN
-         valueInt64 = bswap_64(sData->counter);
-#endif
-         break;
-      case SENSOR_BATTERY:
-      {
-         int offset = (int)payload[4];
-         sData->batt = CalculateBatteryVoltage(offset);
-         nxlog_debug(7, _T("LoraWAN Module: Batt %f"), sData->batt);
-      }
-         break;
-      case SENSOR_TEMP:
-         sData->temp = (int)payload[5];
-         nxlog_debug(7, _T("LoraWAN Module: Temp %d"), sData->temp);
-         break;
-      case SENSOR_RSSI:
-         sData->rssi = (INT32)(char)payload[6];
-         nxlog_debug(7, _T("LoraWAN Module: rssi %d"), sData->rssi);
-         break;
-      case SENSOR_WATCH_MODE:
-         sData->watchMode =(payload[7] & 0x01) ? 1 : 0;
-         nxlog_debug(7, _T("LoraWAN Module: watch m %d"), sData->watchMode);
-         break;
-      case SENSOR_WATCH_STATUS:
-         sData->watchStatus =(payload[8] & 0x01) ? 1 : 0;
-         nxlog_debug(7, _T("LoraWAN Module: watchStatus m %d"), sData->watchStatus);
-         break;
-      case SENSOR_LEAK_MODE:
-         sData->leakMode =(payload[7] & 0x02) ? 1 : 0;
-         nxlog_debug(7, _T("LoraWAN Module: leakMode m %d"), sData->leakMode);
-         break;
-      case SENSOR_LEAK_STATUS:
-         sData->leakStatus =(payload[8] & 0x02) ? 1 : 0;
-         nxlog_debug(7, _T("LoraWAN Module: leakStatus m %d"), sData->leakStatus);
-         break;
-      case SENSOR_REV_FLOW_MODE:
-         sData->revFlowMode =(payload[7] & 0x04) ? 1 : 0;
-         nxlog_debug(7, _T("LoraWAN Module: revFlowMode m %d"), sData->revFlowMode);
-         break;
-      case SENSOR_REV_FLOW_STATUS:
-         sData->revFlowStatus =(payload[8] & 0x04) ? 1 : 0;
-         nxlog_debug(7, _T("LoraWAN Module: revFlowStatus m %d"), sData->revFlowStatus);
-         break;
-      case SENSOR_TAMPER_MODE:
-         sData->tamperMode =(payload[7] & 0x08) ? 1 : 0;
-         nxlog_debug(7, _T("LoraWAN Module: tamperMode m %d"), sData->tamperMode);
-         break;
-      case SENSOR_TAMPER_STATUS:
-         sData->tamperStatus =(payload[8] & 0x08) ? 1 : 0;
-         nxlog_debug(7, _T("LoraWAN Module: tamperStatus m %d"), sData->tamperStatus);
-         break;
-      case SENSOR_MODE:
-         sData->sensorMode =(payload[7] & 0x10) ? 1 : 0;
-         nxlog_debug(7, _T("LoraWAN Module: sensorMode m %d"), sData->sensorMode);
-         break;
-      case SENSOR_REPORTING_MODE:
-         sData->reportingMode =(payload[7] & 0x20) ? 1 : 0;
-         nxlog_debug(7, _T("LoraWAN Module: reportingMode m %d"), sData->reportingMode);
-         break;
-      case SENSOR_TEMP_DETECT_MODE:
-         sData->tempDetectMode =(payload[7] & 0x40) ? 1 : 0;
-         nxlog_debug(7, _T("LoraWAN Module: tempDetectMode m %d"), sData->tempDetectMode);
-         break;
-      case SENSOR_TEMP_DETECT_STATUS:
-         sData->tempDetectStatus =(payload[8] & 0x40) ? 1 : 0;
-         nxlog_debug(7, _T("LoraWAN Module: tempDetectStatus m %d"), sData->tempDetectStatus);
-         break;
-   }
-}
-
-/**
- * Decodes LoraWAN device payload
- */
-bool Decode(const TCHAR *name, const void *data, void *result)
-{
-   LoraDeviceData *dData = (LoraDeviceData *)data;
-   if (dData == NULL  || dData->getDecoder() != NAS)
-      return false;
-
-   SensorData *sData = FindSensor(dData->getGuid());
-   if (sData == NULL) // Create new entry
-   {
-      sData = new struct SensorData();
-      sData->guid = dData->getGuid();
-      AddSensor(sData);
-   }
-
-   switch(dData->getPort())
-   {
-      case 24:
-         ParsePayload(sData, dData->getPayload(), SENSOR_COUNTER32);
-         ParsePayload(sData, dData->getPayload(), SENSOR_BATTERY);
-         ParsePayload(sData, dData->getPayload(), SENSOR_TEMP);
-         ParsePayload(sData, dData->getPayload(), SENSOR_RSSI);
-         ParsePayload(sData, dData->getPayload(), SENSOR_WATCH_MODE);
-         ParsePayload(sData, dData->getPayload(), SENSOR_WATCH_STATUS);
-         ParsePayload(sData, dData->getPayload(), SENSOR_LEAK_MODE);
-         ParsePayload(sData, dData->getPayload(), SENSOR_LEAK_STATUS);
-         ParsePayload(sData, dData->getPayload(), SENSOR_REV_FLOW_MODE);
-         ParsePayload(sData, dData->getPayload(), SENSOR_REV_FLOW_STATUS);
-         ParsePayload(sData, dData->getPayload(), SENSOR_TAMPER_MODE);
-         ParsePayload(sData, dData->getPayload(), SENSOR_TAMPER_STATUS);
-         ParsePayload(sData, dData->getPayload(), SENSOR_MODE);
-         ParsePayload(sData, dData->getPayload(), SENSOR_REPORTING_MODE);
-         ParsePayload(sData, dData->getPayload(), SENSOR_TEMP_DETECT_MODE);
-         ParsePayload(sData, dData->getPayload(), SENSOR_TEMP_DETECT_STATUS);
-         break;
-      case 6:
-         if (sData->reportingMode)
-         {
-            sData->counter = 0;
-            sData->reportingMode = 0;
-         }
-         ParsePayload(sData, dData->getPayload(), SENSOR_COUNTER64);
-         break;
-      case 14:
-         if (!sData->reportingMode)
-         {
-            sData->counter = 0;
-            sData->reportingMode = 1;
-         }
-         ParsePayload(sData, dData->getPayload(), SENSOR_COUNTER64);
-         break;
-      case 99: // Boot message
-         return true;
-      default:
-         return false;
-   }
-   nxlog_debug(7, _T("LoraWAN Module: Sensor[%s] updated"), (const TCHAR*)sData->guid.toString());
-
-   return true;
-}
-
-/**
- * Handler for sensor data
- */
-LONG H_Sensor(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractCommSession *session)
-{
-   TCHAR guid[38];
-   if (!AgentGetParameterArg(param, 1, guid, 38))
-      return SYSINFO_RC_ERROR;
-
-   SensorData *data = FindSensor(uuid::parse(guid));
-   if (data == NULL)
-      return SYSINFO_RC_ERROR;
-
-   switch(*arg)
-   {
-      case 'B':
-         ret_double(value, data->batt, 3);
-         break;
-      case 'R':
-         ret_int(value, data->rssi);
-         break;
-      case 'U':
-         ret_uint64(value, data->counter);
-         break;
-      default:
-         return SYSINFO_RC_UNSUPPORTED;
-   }
-
-   return SYSINFO_RC_SUCCESS;
-}
-
-/**
- * Handler for sensor modes
- */
-LONG H_Mode(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractCommSession *session)
-{
-   TCHAR guid[38];
-   if (!AgentGetParameterArg(param, 1, guid, 38))
-      return SYSINFO_RC_ERROR;
-
-   SensorData *data = FindSensor(uuid::parse(guid));
-   if (data == NULL)
-      return SYSINFO_RC_ERROR;
-
-   switch(*arg)
-   {
-      case 'A':
-         ret_uint(value, data->tamperMode);
-         break;
-      case 'F':
-         ret_uint(value, data->revFlowMode);
-         break;
-      case 'L':
-         ret_uint(value, data->leakMode);
-         break;
-      case 'R':
-         ret_uint(value, data->reportingMode);
-         break;
-      case 'S':
-         ret_uint(value, data->sensorMode);
-         break;
-      case 'T':
-         ret_uint(value, data->temp);
-         break;
-      case 'W':
-         ret_uint(value, data->watchMode);
-         break;
-      default:
-         return SYSINFO_RC_UNSUPPORTED;
-   }
-
-   return SYSINFO_RC_SUCCESS;
-}
-
-/**
- * Handler for sensor status
- */
-LONG H_Status(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractCommSession *session)
-{
-   TCHAR guid[38];
-   if (!AgentGetParameterArg(param, 1, guid, 38))
-      return SYSINFO_RC_ERROR;
-
-   SensorData *data = FindSensor(uuid::parse(guid));
-   if (data == NULL)
-      return SYSINFO_RC_ERROR;
-
-   switch(*arg)
-   {
-      case 'A':
-         ret_uint(value, data->tamperStatus);
-         break;
-      case 'D':
-         ret_uint(value, data->tempDetectStatus);
-         break;
-      case 'L':
-         ret_uint(value, data->leakStatus);
-         break;
-      case 'R':
-         ret_uint(value, data->revFlowStatus);
-         break;
-      case 'T':
-         ret_uint(value, data->temp);
-         break;
-      case 'W':
-         ret_uint(value, data->watchStatus);
-         break;
-      default:
-         return SYSINFO_RC_UNSUPPORTED;
-   }
-
-   return SYSINFO_RC_SUCCESS;
-}
diff --git a/src/agent/subagents/nas/main.cpp b/src/agent/subagents/nas/main.cpp
deleted file mode 100644 (file)
index e328884..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- ** NAS Smart water meter retrofit decoder for LoraWAN subagent
- ** Copyright (C) 2009 - 2017 Raden Solutions
- **
- ** 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
- ** the Free Software Foundation; either version 2 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program; if not, write to the Free Software
- ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- **
- **/
-
-#include "nas.h"
-
-/**
- * Sensor data map
- */
-HashMap<uuid, SensorData> g_sensorMap(true);
-
-/**
- * Find sensor data in local cache
- */
- SensorData *FindSensor(uuid guid)
-{
-   SensorData *data;
-   MutexLock(s_sensorMapMutex);
-   data = g_sensorMap.get(guid);
-   MutexUnlock(s_sensorMapMutex);
-
-   return data;
-}
-
-/**
- * Add sensor data to local cache
- */
-void AddSensor(SensorData *data)
-{
-   MutexLock(s_sensorMapMutex);
-   g_sensorMap.set(data->guid, data);
-   MutexUnlock(s_sensorMapMutex);
-}
-
-/**
- * Startup handler
- */
-static BOOL SubagentInit(Config *config)
-{
-   s_sensorMapMutex = MutexCreate();
-
-   NXMBDispatcher *dispatcher = NXMBDispatcher::getInstance();
-   dispatcher->addCallHandler(_T("NOTIFY_DECODERS"), Decode);
-
-   return TRUE;
-}
-
-/**
- * Shutdown handler
- */
-static void SubagentShutdown()
-{
-   NXMBDispatcher *dispatcher = NXMBDispatcher::getInstance();
-   dispatcher->removeCallHandler(_T("NOTIFY_DECODERS"));
-   g_sensorMap.clear();
-   MutexDestroy(s_sensorMapMutex);
-}
-
-/**
- * Parameters
- */
-static NETXMS_SUBAGENT_PARAM m_parameters[] =
-{
-       { _T("WaterMeter.Usage(*)"), H_Sensor, _T("U"), DCI_DT_UINT64, _T("Usage") },
-       { _T("WaterMeter.Battery(*)"), H_Sensor, _T("B"), DCI_DT_FLOAT, _T("Battery voltage") },
-   { _T("WaterMeter.RSSI(*)"), H_Sensor, _T("R"), DCI_DT_INT, _T("RSSI") },
-       { _T("WaterMeter.Temperature(*)"), H_Status, _T("T"), DCI_DT_UINT, _T("Temperature") },
-   { _T("WaterMeter.Watch.Mode(*)"), H_Mode, _T("W"), DCI_DT_UINT, _T("Watch mode") },
-   { _T("WaterMeter.Watch.Status(*)"), H_Status, _T("W"), DCI_DT_UINT, _T("Watch status") },
-   { _T("WaterMeter.Leak.Mode(*)"), H_Mode, _T("L"), DCI_DT_UINT, _T("Leak mode") },
-   { _T("WaterMeter.Leak.Status(*)"), H_Status, _T("L"), DCI_DT_UINT, _T("Leak status") },
-   { _T("WaterMeter.ReverseFlow.Mode(*)"), H_Mode, _T("F"), DCI_DT_UINT, _T("Reverse flow mode") },
-   { _T("WaterMeter.ReverseFlow.Status(*)"), H_Status, _T("R"), DCI_DT_UINT, _T("Reverse flow status") },
-   { _T("WaterMeter.Tamper.Mode(*)"), H_Mode, _T("A"), DCI_DT_UINT, _T("Tamper mode") },
-   { _T("WaterMeter.Tamper.Status(*)"), H_Status, _T("A"), DCI_DT_UINT, _T("Tamper status") },
-   { _T("WaterMeter.Sensor.Mode(*)"), H_Mode, _T("S"), DCI_DT_UINT, _T("Sensor mode") },
-   { _T("WaterMeter.Reporting.Mode(*)"), H_Mode, _T("R"), DCI_DT_UINT, _T("Reporting mode") },
-   { _T("WaterMeter.TemperatureDetection.Mode(*)"), H_Mode, _T("T"), DCI_DT_UINT, _T("Temperature detection mode") },
-   { _T("WaterMeter.TemperatureDetection.Status(*)"), H_Status, _T("D"), DCI_DT_UINT, _T("Temperature detection status") }
-};
-
-/**
- * Subagent information
- */
-static NETXMS_SUBAGENT_INFO m_info =
-{
-       NETXMS_SUBAGENT_INFO_MAGIC,
-       _T("NAS"), NETXMS_VERSION_STRING,
-       SubagentInit,
-       SubagentShutdown,
-       NULL, // command handler
-       sizeof(m_parameters) / sizeof(NETXMS_SUBAGENT_PARAM),
-       m_parameters,
-       0, NULL,                // lists
-       0, NULL,                // tables
-       0, NULL,    // actions
-       0, NULL         // push parameters
-};
-
-/**
- * Entry point for NetXMS agent
- */
-DECLARE_SUBAGENT_ENTRY_POINT(NAS)
-{
-       *ppInfo = &m_info;
-       return TRUE;
-}
diff --git a/src/agent/subagents/nas/nas.h b/src/agent/subagents/nas/nas.h
deleted file mode 100644 (file)
index b1fafef..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- ** NAS Smart water meter retrofit decoder for LoraWAN subagent
- ** Copyright (C) 2009 - 2017 Raden Solutions
- **
- ** 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
- ** the Free Software Foundation; either version 2 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program; if not, write to the Free Software
- ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- **
- **/
-
-#include <nms_agent.h>
-#include <nms_util.h>
-#include <nxmbapi.h>
-
-/**
- * Decoder ID
- */
-#define NAS 0
-
-/**
- * Sensor data field defines
- */
-#define SENSOR_COUNTER32            0
-#define SENSOR_COUNTER64            1
-#define SENSOR_BATTERY              2
-#define SENSOR_TEMP                 3
-#define SENSOR_RSSI                 4
-#define SENSOR_WATCH_MODE           5
-#define SENSOR_WATCH_STATUS         6
-#define SENSOR_LEAK_MODE            7
-#define SENSOR_LEAK_STATUS          8
-#define SENSOR_REV_FLOW_MODE        9
-#define SENSOR_REV_FLOW_STATUS      10
-#define SENSOR_TAMPER_MODE          11
-#define SENSOR_TAMPER_STATUS        12
-#define SENSOR_MODE                 13
-#define SENSOR_REPORTING_MODE       14
-#define SENSOR_TEMP_DETECT_MODE     15
-#define SENSOR_TEMP_DETECT_STATUS   16
-
-/**
- * Sensor data struct
- */
-struct SensorData
-{
-   uuid guid;
-   UINT64 counter;
-   double batt;
-   INT32 rssi;
-   INT32 temp;
-   UINT32 watchMode;
-   UINT32 watchStatus;
-   UINT32 leakMode;
-   UINT32 leakStatus;
-   UINT32 revFlowMode;
-   UINT32 revFlowStatus;
-   UINT32 tamperMode;
-   UINT32 tamperStatus;
-   UINT32 sensorMode;
-   UINT32 reportingMode;
-   UINT32 tempDetectMode;
-   UINT32 tempDetectStatus;
-
-   ~SensorData() {}
-};
-
-/**
- * Sensor data map
- */
-extern HashMap<uuid, SensorData> g_sensorMap;
-
-/**
- * Sensor map mutex
- */
-static MUTEX s_sensorMapMutex = INVALID_MUTEX_HANDLE;
-
-/**
- * Sensor data handlers
- */
-LONG H_Sensor(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractCommSession *session);
-LONG H_Mode(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractCommSession *session);
-LONG H_Status(const TCHAR *param, const TCHAR *arg, TCHAR *value, AbstractCommSession *session);
-
-/**
- * Sensor map functions
- */
-SensorData *FindSensor(uuid guid);
-void AddSensor(SensorData *data);
-
-/**
- * NXMBDispatcher handler
- */
-bool Decode(const TCHAR *name, const void *data, void *result);