all command line client tools converted to new client library; message wait queue...
authorVictor Kirhenshtein <victor@netxms.org>
Thu, 4 Dec 2014 21:39:22 +0000 (23:39 +0200)
committerVictor Kirhenshtein <victor@netxms.org>
Thu, 4 Dec 2014 21:39:22 +0000 (23:39 +0200)
21 files changed:
include/Makefile.am
include/nxclient.h
include/nxclobj.h [new file with mode: 0644]
include/nxcpapi.h
netxms.sln
src/client/libnxclient/Makefile.am
src/client/libnxclient/alarms.cpp [new file with mode: 0644]
src/client/libnxclient/events.cpp [new file with mode: 0644]
src/client/libnxclient/libnxclient.vcproj
src/client/libnxclient/objects.cpp [new file with mode: 0644]
src/client/libnxclient/server.cpp [new file with mode: 0644]
src/client/libnxclient/session.cpp
src/client/nxalarm/nxalarm.cpp
src/client/nxalarm/nxalarm.h
src/client/nxevent/nxevent.cpp
src/client/nxevent/nxevent.h
src/client/nxsms/nxsms.cpp
src/client/nxsms/nxsms.h
src/java/client/netxms-client/src/main/java/org/netxms/client/NXCSession.java
src/libnetxms/message.cpp
src/libnetxms/msgwq.cpp

index 755770b..a750ecd 100644 (file)
@@ -33,6 +33,7 @@ include_HEADERS = \
        nxclapi.h \
        nxcldefs.h \
        nxclient.h \
+       nxclobj.h \
        nxconfig.h \
        nxcpapi.h \
        nxdbapi.h \
index dabd4b6..181b3bc 100644 (file)
@@ -43,6 +43,8 @@
 #define LIBNXCLIENT_EXPORTABLE
 #endif
 
+#include "nxclobj.h"
+
 #define MAX_TZ_LEN         32
 
 /**
@@ -61,6 +63,7 @@
 #define CONTROLLER_DATA_COLLECTION  _T("DATACOLL")
 #define CONTROLLER_EVENTS           _T("EVENTS")
 #define CONTROLLER_OBJECTS          _T("OBJECTS")
+#define CONTROLLER_SERVER           _T("SERVER")
 
 /**
  * DCI push data
@@ -91,6 +94,32 @@ protected:
 
 public:
    Controller(NXCSession *session) { m_session = session; }
+   virtual ~Controller();
+};
+
+/**
+ * Alarm comment
+ */
+class LIBNXCLIENT_EXPORTABLE AlarmComment
+{
+private:
+   UINT32 m_id;
+   UINT32 m_alarmId;
+   UINT32 m_userId;
+   TCHAR *m_userName;
+   time_t m_timestamp;
+   TCHAR *m_text;
+
+public:
+   AlarmComment(NXCPMessage *msg, UINT32 baseId);
+   ~AlarmComment();
+
+   UINT32 getId() { return m_id; }
+   UINT32 getAlarmId() { return m_alarmId; }
+   UINT32 getUserId() { return m_userId; }
+   const TCHAR *getUserName() { return m_userName; }
+   time_t getTimestamp() { return m_timestamp; }
+   const TCHAR *getText() { return m_text; }
 };
 
 /**
@@ -98,13 +127,24 @@ public:
  */
 class LIBNXCLIENT_EXPORTABLE AlarmController : public Controller
 {
+private:
+   NXC_ALARM *createAlarmFromMessage(NXCPMessage *msg);
+
 public:
    AlarmController(NXCSession *session) : Controller(session) { }
 
-   UINT32 acknowledge(UINT32 alarmId, bool sticky = false);
+   UINT32 getAll(ObjectArray<NXC_ALARM> **alarms);
+
+   UINT32 acknowledge(UINT32 alarmId, bool sticky = false, UINT32 timeout = 0);
    UINT32 resolve(UINT32 alarmId);
    UINT32 terminate(UINT32 alarmId);
-   ObjectArray<NXC_ALARM> *get();
+   UINT32 openHelpdeskIssue(UINT32 alarmId, TCHAR *helpdeskRef);
+   
+   UINT32 getComments(UINT32 alarmId, ObjectArray<AlarmComment> **comments);
+   UINT32 addComment(UINT32 alarmId, const TCHAR *text);
+   UINT32 updateComment(UINT32 alarmId, UINT32 commentId, const TCHAR *text);
+
+   TCHAR *formatAlarmText(NXC_ALARM *alarm, const TCHAR *format);
 };
 
 /**
@@ -118,27 +158,87 @@ public:
    UINT32 pushData(ObjectArray<NXCPushData> *data, UINT32 *failedIndex = NULL);
 };
 
+/**
+ * Event template
+ */
+class LIBNXCLIENT_EXPORTABLE EventTemplate
+{
+private:
+   UINT32 m_code;
+   TCHAR m_name[MAX_EVENT_NAME];
+   int m_severity;
+   UINT32 m_flags;
+   TCHAR *m_messageTemplate;
+   TCHAR *m_description;
+
+public:
+   EventTemplate(NXCPMessage *msg);
+   ~EventTemplate();
+
+   UINT32 getCode() { return m_code; }
+   const TCHAR *getName() { return m_name; }
+   int getSeverity() { return m_severity; }
+   UINT32 getFlags() { return m_flags; }
+   const TCHAR *getMessageTemplate() { return CHECK_NULL_EX(m_messageTemplate); }
+   const TCHAR *getDescription() { return CHECK_NULL_EX(m_description); }
+};
+
 /**
  * Event controller
  */
 class LIBNXCLIENT_EXPORTABLE EventController : public Controller
 {
+private:
+   MUTEX m_eventTemplateLock;
+   ObjectArray<EventTemplate> *m_eventTemplates;
+
 public:
-   EventController(NXCSession *session) : Controller(session) { }
+   EventController(NXCSession *session);
+   virtual ~EventController();
+
+   UINT32 syncEventTemplates();
+   UINT32 getEventTemplates(ObjectArray<EventTemplate> *templates);
+   TCHAR *getEventName(UINT32 code, TCHAR *buffer, size_t bufferSize);
+
+   UINT32 sendEvent(UINT32 code, const TCHAR *name, UINT32 objectId, int argc, TCHAR **argv, const TCHAR *userTag);
 };
 
+struct ObjectCacheEntry;
+
 /**
  * Object controller
  */
 class LIBNXCLIENT_EXPORTABLE ObjectController : public Controller
 {
+private:
+   ObjectCacheEntry *m_cache;
+   MUTEX m_cacheLock;
+
 public:
-   ObjectController(NXCSession *session) : Controller(session) { }
+   ObjectController(NXCSession *session);
+   virtual ~ObjectController();
+
+   UINT32 sync();
+   UINT32 syncObjectSet(UINT32 *idList, size_t length, bool syncComments, UINT16 flags);
+   UINT32 syncSingleObject(UINT32 id);
+
+   AbstractObject *findObjectById(UINT32 id);
 
    UINT32 manage(UINT32 objectId);
    UINT32 unmanage(UINT32 objectId);
 };
 
+/**
+ * Server controller
+ */
+class LIBNXCLIENT_EXPORTABLE ServerController : public Controller
+{
+public:
+   ServerController(NXCSession *session) : Controller(session) { }
+
+   UINT32 sendSMS(const TCHAR *recipient, const TCHAR *text);
+};
+
 /**
  * Session
  */
diff --git a/include/nxclobj.h b/include/nxclobj.h
new file mode 100644 (file)
index 0000000..e16f028
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+** NetXMS - Network Management System
+** Client Library API
+** Copyright (C) 2003-2014 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
+** the Free Software Foundation; either version 3 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 Lesser General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+** File: nxclobj.h
+**
+**/
+
+#ifndef _nxclobj_h_
+#define _nxclobj_h_
+
+#include <geolocation.h>
+
+/**
+ * Generic object class
+ */
+class LIBNXCLIENT_EXPORTABLE AbstractObject : public RefCountObject
+{
+protected:
+   UINT32 m_id;
+   uuid_t m_guid;
+   int m_class;
+   TCHAR m_name[MAX_OBJECT_NAME];
+   int m_status;
+   InetAddress m_primaryIP;
+   TCHAR *m_comments;
+   StringMap m_customAttributes;
+   UINT32 m_submapId;
+   IntegerArray<UINT32> *m_parents;
+   IntegerArray<UINT32> *m_children;
+   GeoLocation m_geoLocation;
+
+public:
+   AbstractObject(NXCPMessage *msg);
+   virtual ~AbstractObject();
+
+   UINT32 getId() { return m_id; }
+   int getObjectClass() { return m_class; }
+   const TCHAR *getName() { return m_name; }
+   const InetAddress& getPrimaryIP() { return m_primaryIP; }
+   const TCHAR *getComments() { return m_comments; }
+   const TCHAR *getCustomAttribute(const TCHAR *name) { return m_customAttributes.get(name); }
+   UINT32 getSubmapId() { return m_submapId; }
+   const GeoLocation& getGeoLocation() { return m_geoLocation; }
+};
+
+/**
+ * Node object
+ */
+class LIBNXCLIENT_EXPORTABLE Node : public AbstractObject
+{
+protected:
+   TCHAR *m_primaryHostname;
+
+public:
+   Node(NXCPMessage *msg);
+   virtual ~Node();
+
+   const TCHAR *getPrimaryHostname() { return m_primaryHostname; }
+};
+
+#endif
index 2d3318c..e1bc875 100644 (file)
@@ -106,7 +106,7 @@ public:
    void setFieldFromMBString(UINT32 fieldId, const char *value) { set(fieldId, NXCP_DT_STRING, value); }
 #endif
    void setFieldFromTime(UINT32 fieldId, time_t value) { UINT64 t = (UINT64)value; set(fieldId, NXCP_DT_INT64, &t); }
-   void setFieldFromInt32Array(UINT32 fieldId, UINT32 dwNumElements, const UINT32 *pdwData);
+   void setFieldFromInt32Array(UINT32 fieldId, size_t numElements, const UINT32 *elements);
    void setFieldFromInt32Array(UINT32 fieldId, IntegerArray<UINT32> *data);
    bool setFieldFromFile(UINT32 fieldId, const TCHAR *pszFileName);
 
@@ -143,6 +143,7 @@ public:
 typedef struct
 {
    void *msg;         // Pointer to message, either to NXCPMessage object or raw message
+   UINT64 sequence;   // Sequence number
    UINT32 id;         // Message ID
    UINT32 ttl;        // Message time-to-live in milliseconds
    UINT16 code;       // Message code
@@ -173,6 +174,7 @@ private:
    int m_size;
    int m_allocated;
    WAIT_QUEUE_ELEMENT *m_elements;
+   UINT64 m_sequence;
    THREAD m_hHkThread;
 
    void housekeeperThread();
index a8cd898..8f67039 100644 (file)
@@ -5,23 +5,23 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libexpat", "src\libexpat\li
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnetxms", "src\libnetxms\libnetxms.vcproj", "{B1745870-F3ED-4ACB-B813-0C4F47EF0793}"
        ProjectSection(ProjectDependencies) = postProject
-               {406AE5C7-343D-4C88-B8F3-84E46255B830} = {406AE5C7-343D-4C88-B8F3-84E46255B830}
                {6A88EF62-C4F2-4295-A833-549DAE4DF5ED} = {6A88EF62-C4F2-4295-A833-549DAE4DF5ED}
+               {406AE5C7-343D-4C88-B8F3-84E46255B830} = {406AE5C7-343D-4C88-B8F3-84E46255B830}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnxlp", "src\libnxlp\libnxlp.vcproj", "{64EFC0C2-C67B-41F6-851D-F11DAB27A60B}"
        ProjectSection(ProjectDependencies) = postProject
-               {406AE5C7-343D-4C88-B8F3-84E46255B830} = {406AE5C7-343D-4C88-B8F3-84E46255B830}
-               {6A88EF62-C4F2-4295-A833-549DAE4DF5ED} = {6A88EF62-C4F2-4295-A833-549DAE4DF5ED}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {6A88EF62-C4F2-4295-A833-549DAE4DF5ED} = {6A88EF62-C4F2-4295-A833-549DAE4DF5ED}
+               {406AE5C7-343D-4C88-B8F3-84E46255B830} = {406AE5C7-343D-4C88-B8F3-84E46255B830}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxagentd", "src\agent\core\nxagentd.vcproj", "{57598B02-3295-4FE8-9322-94CE871CC84D}"
        ProjectSection(ProjectDependencies) = postProject
-               {6B249E47-4BAF-4DE2-B62B-C6DD0330753F} = {6B249E47-4BAF-4DE2-B62B-C6DD0330753F}
-               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
-               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
+               {6B249E47-4BAF-4DE2-B62B-C6DD0330753F} = {6B249E47-4BAF-4DE2-B62B-C6DD0330753F}
        EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "subagents", "subagents", "{451F583D-C2DB-4414-870C-7FA0189BE7DD}"
@@ -61,8 +61,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sms", "src\agent\subagents\
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "portcheck", "src\agent\subagents\portcheck\portcheck.vcproj", "{F66A27F0-2943-4A16-ACC7-B450314B5163}"
        ProjectSection(ProjectDependencies) = postProject
-               {406AE5C7-343D-4C88-B8F3-84E46255B830} = {406AE5C7-343D-4C88-B8F3-84E46255B830}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {406AE5C7-343D-4C88-B8F3-84E46255B830} = {406AE5C7-343D-4C88-B8F3-84E46255B830}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ping", "src\agent\subagents\ping\ping.vcproj", "{C5CCF5DE-152E-40F3-AC6C-C5E54BB7C45F}"
@@ -77,8 +77,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "odbcquery", "src\agent\suba
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "logwatch", "src\agent\subagents\logwatch\logwatch.vcproj", "{F8A8749E-E539-4A3B-A21C-2C5C86AE33EA}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {64EFC0C2-C67B-41F6-851D-F11DAB27A60B} = {64EFC0C2-C67B-41F6-851D-F11DAB27A60B}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ecs", "src\agent\subagents\ecs\ecs.vcproj", "{BBE9028E-725C-45C6-97C9-BFC443F19DB6}"
@@ -95,114 +95,114 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnxmap", "src\libnxmap\li
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnxcl", "src\libnxcl\libnxcl.vcproj", "{3CB9B8C6-E6BF-4002-A61A-7A21FEADB531}"
        ProjectSection(ProjectDependencies) = postProject
-               {AB386821-B630-49F5-95C3-677B9DCE1270} = {AB386821-B630-49F5-95C3-677B9DCE1270}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {AB386821-B630-49F5-95C3-677B9DCE1270} = {AB386821-B630-49F5-95C3-677B9DCE1270}
        EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{39BF23C9-D903-4C20-8E88-19533A745625}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxalarm", "src\client\nxalarm\nxalarm.vcproj", "{F9FFAAE9-D669-451E-B9EF-18BC8AD37FAB}"
        ProjectSection(ProjectDependencies) = postProject
+               {B2C8E7C8-E047-46E8-ADDB-0BB819F72288} = {B2C8E7C8-E047-46E8-ADDB-0BB819F72288}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
-               {3CB9B8C6-E6BF-4002-A61A-7A21FEADB531} = {3CB9B8C6-E6BF-4002-A61A-7A21FEADB531}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxevent", "src\client\nxevent\nxevent.vcproj", "{C7A460E8-12A8-4FC7-9F59-C9C5CE17ED20}"
        ProjectSection(ProjectDependencies) = postProject
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
-               {3CB9B8C6-E6BF-4002-A61A-7A21FEADB531} = {3CB9B8C6-E6BF-4002-A61A-7A21FEADB531}
+               {B2C8E7C8-E047-46E8-ADDB-0BB819F72288} = {B2C8E7C8-E047-46E8-ADDB-0BB819F72288}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxpush", "src\client\nxpush\nxpush.vcproj", "{B8671BF7-94E1-4615-A8C2-F5C78DB8C515}"
        ProjectSection(ProjectDependencies) = postProject
-               {B2C8E7C8-E047-46E8-ADDB-0BB819F72288} = {B2C8E7C8-E047-46E8-ADDB-0BB819F72288}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {B2C8E7C8-E047-46E8-ADDB-0BB819F72288} = {B2C8E7C8-E047-46E8-ADDB-0BB819F72288}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxsms", "src\client\nxsms\nxsms.vcproj", "{B0A70A32-A8F0-4071-8044-FDA3C834A5C5}"
        ProjectSection(ProjectDependencies) = postProject
+               {B2C8E7C8-E047-46E8-ADDB-0BB819F72288} = {B2C8E7C8-E047-46E8-ADDB-0BB819F72288}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
-               {3CB9B8C6-E6BF-4002-A61A-7A21FEADB531} = {3CB9B8C6-E6BF-4002-A61A-7A21FEADB531}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnxsnmp", "src\snmp\libnxsnmp\libnxsnmp.vcproj", "{7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}"
        ProjectSection(ProjectDependencies) = postProject
-               {E7410EB4-3355-4C83-8E05-D2877581CDA1} = {E7410EB4-3355-4C83-8E05-D2877581CDA1}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {E7410EB4-3355-4C83-8E05-D2877581CDA1} = {E7410EB4-3355-4C83-8E05-D2877581CDA1}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxzlib", "src\zlib\nxzlib.vcproj", "{E7410EB4-3355-4C83-8E05-D2877581CDA1}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxsnmpget", "src\snmp\nxsnmpget\nxsnmpget.vcproj", "{0A4CE471-020A-42C6-91C0-DFEFA7E815E0}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxsnmpset", "src\snmp\nxsnmpset\nxsnmpset.vcproj", "{9EA98E79-EB7D-4F6C-8105-AC7B231ABB10}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxsnmpwalk", "src\snmp\nxsnmpwalk\nxsnmpwalk.vcproj", "{5FA3AADC-3AD7-4B17-A581-D5E02DE17727}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxmibc", "src\snmp\nxmibc\nxmibc.vcproj", "{9F722C62-78FD-4D8C-A7C7-2815B09F1943}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnxsrv", "src\server\libnxsrv\libnxsrv.vcproj", "{CB89D905-C8BE-4027-B2D8-F96C245E9160}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxcore", "src\server\core\nxcore.vcproj", "{3B172035-5EEC-45A3-8471-2C390B7ED683}"
        ProjectSection(ProjectDependencies) = postProject
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
-               {F4169894-5C48-4E11-A82E-1055F9572EEF} = {F4169894-5C48-4E11-A82E-1055F9572EEF}
-               {B2988503-1921-4B9F-BBC1-5E5CF62F335E} = {B2988503-1921-4B9F-BBC1-5E5CF62F335E}
-               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
-               {406AE5C7-343D-4C88-B8F3-84E46255B830} = {406AE5C7-343D-4C88-B8F3-84E46255B830}
-               {64EFC0C2-C67B-41F6-851D-F11DAB27A60B} = {64EFC0C2-C67B-41F6-851D-F11DAB27A60B}
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
-               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
                {AB386821-B630-49F5-95C3-677B9DCE1270} = {AB386821-B630-49F5-95C3-677B9DCE1270}
+               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {64EFC0C2-C67B-41F6-851D-F11DAB27A60B} = {64EFC0C2-C67B-41F6-851D-F11DAB27A60B}
+               {406AE5C7-343D-4C88-B8F3-84E46255B830} = {406AE5C7-343D-4C88-B8F3-84E46255B830}
+               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {B2988503-1921-4B9F-BBC1-5E5CF62F335E} = {B2988503-1921-4B9F-BBC1-5E5CF62F335E}
+               {F4169894-5C48-4E11-A82E-1055F9572EEF} = {F4169894-5C48-4E11-A82E-1055F9572EEF}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
        EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "nxsl", "nxsl", "{CE0DA89E-CF0C-452C-9C33-75A143355BDC}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnxsl", "src\libnxsl\libnxsl.vcproj", "{B2988503-1921-4B9F-BBC1-5E5CF62F335E}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {406AE5C7-343D-4C88-B8F3-84E46255B830} = {406AE5C7-343D-4C88-B8F3-84E46255B830}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxscript", "src\nxscript\nxscript.vcproj", "{BA263F92-D5A9-4F26-9606-5A1C1495FEA5}"
        ProjectSection(ProjectDependencies) = postProject
-               {B2988503-1921-4B9F-BBC1-5E5CF62F335E} = {B2988503-1921-4B9F-BBC1-5E5CF62F335E}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {B2988503-1921-4B9F-BBC1-5E5CF62F335E} = {B2988503-1921-4B9F-BBC1-5E5CF62F335E}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "netxmsd", "src\server\netxmsd\netxmsd.vcproj", "{E417A0C4-41F1-4F87-8C33-8526ECB1F8AF}"
        ProjectSection(ProjectDependencies) = postProject
-               {3B172035-5EEC-45A3-8471-2C390B7ED683} = {3B172035-5EEC-45A3-8471-2C390B7ED683}
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {3B172035-5EEC-45A3-8471-2C390B7ED683} = {3B172035-5EEC-45A3-8471-2C390B7ED683}
        EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{64482674-7B36-4A14-A612-247333174315}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxaction", "src\server\tools\nxaction\nxaction.vcproj", "{BF5CE6BA-C84A-4448-B1B7-1B355AC77D12}"
        ProjectSection(ProjectDependencies) = postProject
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxadm", "src\server\tools\nxadm\nxadm.vcproj", "{67E35735-2115-45FF-9E93-EE67AF5C9C2C}"
@@ -212,43 +212,43 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxadm", "src\server\tools\n
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxget", "src\server\tools\nxget\nxget.vcproj", "{1AC3C8D1-E309-4327-9E17-0E4CE0FC68CF}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxupload", "src\server\tools\nxupload\nxupload.vcproj", "{DA863269-ED58-4910-AA6A-2572A3EE745D}"
        ProjectSection(ProjectDependencies) = postProject
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxdbmgr", "src\server\tools\nxdbmgr\nxdbmgr.vcproj", "{4940613E-A11C-4259-95C8-8D23217EE60E}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
-               {87CAA25D-991E-45E1-BB69-337D45121F19} = {87CAA25D-991E-45E1-BB69-337D45121F19}
-               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
                {AB386821-B630-49F5-95C3-677B9DCE1270} = {AB386821-B630-49F5-95C3-677B9DCE1270}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
+               {87CAA25D-991E-45E1-BB69-337D45121F19} = {87CAA25D-991E-45E1-BB69-337D45121F19}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "smsdrv", "smsdrv", "{5818CCA9-B585-44B8-B29E-98B1DC278A3C}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "generic", "src\server\smsdrv\generic\generic.vcproj", "{41A5009F-4467-4D89-A171-5A919FEFE16E}"
        ProjectSection(ProjectDependencies) = postProject
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxagent", "src\server\smsdrv\nxagent\nxagent.vcproj", "{C317231C-B984-4423-ACF2-C19DE8B6AA3F}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxlptest", "src\nxlptest\nxlptest.vcproj", "{1EA79FC6-F395-43DF-9E3C-2030CA05ED1D}"
        ProjectSection(ProjectDependencies) = postProject
-               {64EFC0C2-C67B-41F6-851D-F11DAB27A60B} = {64EFC0C2-C67B-41F6-851D-F11DAB27A60B}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {64EFC0C2-C67B-41F6-851D-F11DAB27A60B} = {64EFC0C2-C67B-41F6-851D-F11DAB27A60B}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxsqlite", "src\sqlite\nxsqlite.vcproj", "{87CAA25D-991E-45E1-BB69-337D45121F19}"
@@ -294,14 +294,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pgsql", "src\db\dbdrv\pgsql
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite", "src\db\dbdrv\sqlite\sqlite.vcproj", "{AA18FD4D-7B01-4932-BA04-B0F54F001F66}"
        ProjectSection(ProjectDependencies) = postProject
-               {87CAA25D-991E-45E1-BB69-337D45121F19} = {87CAA25D-991E-45E1-BB69-337D45121F19}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {87CAA25D-991E-45E1-BB69-337D45121F19} = {87CAA25D-991E-45E1-BB69-337D45121F19}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxconfig", "src\server\tools\nxconfig\nxconfig.vcproj", "{A76CCCF5-D70B-4307-B84C-219289CEAA6D}"
        ProjectSection(ProjectDependencies) = postProject
-               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
        EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "flow analyzer", "flow analyzer", "{89B3A66E-5853-4B14-A5E3-9E4C6524BE65}"
@@ -313,9 +313,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libipfix", "src\flow_analyz
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxflowd", "src\flow_analyzer\nxflowd\nxflowd.vcproj", "{D7F709ED-7483-49F0-8B17-ABB705606FEA}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
-               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
                {2DEF303B-5FEF-4F5E-87C4-FB7895058F59} = {2DEF303B-5FEF-4F5E-87C4-FB7895058F59}
+               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "db2", "src\db\dbdrv\db2\db2.vcproj", "{297D9A45-B928-4470-91B5-0E07A20C2405}"
@@ -325,8 +325,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "db2", "src\db\dbdrv\db2\db2
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxap", "src\server\tools\nxap\nxap.vcproj", "{36749C31-C8C6-4DD2-A11C-E41ED86927C7}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtre", "src\libtre\libtre.vcproj", "{406AE5C7-343D-4C88-B8F3-84E46255B830}"
@@ -335,50 +335,50 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "drivers", "drivers", "{5399
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "baystack", "src\server\drivers\baystack\baystack.vcproj", "{13A91F2E-A17B-4ABA-B5B2-285807BD7832}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
-               {DA651576-4E4F-448C-A0A3-9EDD15C81078} = {DA651576-4E4F-448C-A0A3-9EDD15C81078}
                {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {DA651576-4E4F-448C-A0A3-9EDD15C81078} = {DA651576-4E4F-448C-A0A3-9EDD15C81078}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ers8000", "src\server\drivers\ers8000\ers8000.vcproj", "{076E6815-4B6B-4F1E-A36C-CD3DD26EA5AC}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
                {DA651576-4E4F-448C-A0A3-9EDD15C81078} = {DA651576-4E4F-448C-A0A3-9EDD15C81078}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "lib", "lib", "{D73BB67D-032B-4FB7-AEB8-5795B246A072}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "avaya-ers", "src\server\drivers\lib\avaya-ers\avaya-ers.vcproj", "{DA651576-4E4F-448C-A0A3-9EDD15C81078}"
        ProjectSection(ProjectDependencies) = postProject
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
                {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cisco", "src\server\drivers\lib\cisco\cisco.vcproj", "{375F95BD-EFBA-4AA3-8DA3-E79779A12896}"
        ProjectSection(ProjectDependencies) = postProject
-               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cat2900xl", "src\server\drivers\cat2900xl\cat2900xl.vcproj", "{FEEF505B-75AE-4E52-8177-51FFC4AB2ED2}"
        ProjectSection(ProjectDependencies) = postProject
-               {375F95BD-EFBA-4AA3-8DA3-E79779A12896} = {375F95BD-EFBA-4AA3-8DA3-E79779A12896}
-               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {375F95BD-EFBA-4AA3-8DA3-E79779A12896} = {375F95BD-EFBA-4AA3-8DA3-E79779A12896}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "portech", "src\server\smsdrv\portech\portech.vcproj", "{7D0A15A1-7F6E-480D-9926-13BB6DAA0E10}"
        ProjectSection(ProjectDependencies) = postProject
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "netscreen", "src\server\drivers\netscreen\netscreen.vcproj", "{500DE9BF-6FC1-4ACB-91A9-308BA1D37F37}"
        ProjectSection(ProjectDependencies) = postProject
-               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "informix", "src\db\dbdrv\informix\informix.vcproj", "{7DE4A043-48B8-4D66-8D3F-8CF5C757EEB5}"
@@ -388,35 +388,35 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "informix", "src\db\dbdrv\in
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "informix", "src\agent\subagents\informix\informix.vcproj", "{12F5AF3E-A688-4852-A0ED-921D0E088AC4}"
        ProjectSection(ProjectDependencies) = postProject
-               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dbemu", "src\server\smsdrv\dbemu\dbemu.vcproj", "{912783D2-CF6F-4040-B564-4E2436EB0827}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
-               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxinstall", "src\nxinstall\nxinstall.vcproj", "{C177FB94-66E8-424E-BDBE-A96C75D2672C}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {B2988503-1921-4B9F-BBC1-5E5CF62F335E} = {B2988503-1921-4B9F-BBC1-5E5CF62F335E}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "catalyst", "src\server\drivers\catalyst\catalyst.vcproj", "{F343CDCB-1DB5-4563-86DF-6AF1596090B2}"
        ProjectSection(ProjectDependencies) = postProject
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
-               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
                {375F95BD-EFBA-4AA3-8DA3-E79779A12896} = {375F95BD-EFBA-4AA3-8DA3-E79779A12896}
+               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "oracle", "src\agent\subagents\oracle\oracle.vcproj", "{90B762AB-B7BA-42D6-9819-C687AB3F59D0}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
-               {406AE5C7-343D-4C88-B8F3-84E46255B830} = {406AE5C7-343D-4C88-B8F3-84E46255B830}
                {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
+               {406AE5C7-343D-4C88-B8F3-84E46255B830} = {406AE5C7-343D-4C88-B8F3-84E46255B830}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{896A7CDA-423A-460A-83E2-6ED37DAE187C}"
@@ -428,14 +428,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxapush", "src\agent\tools\
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "procurve", "src\server\drivers\procurve\procurve.vcproj", "{B51F1406-AF43-4396-96C0-31176DDAA3FB}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dell-pwc", "src\server\drivers\dell-pwc\dell-pwc.vcproj", "{4CD8D04D-375D-40B5-AB1C-C8AC8A38FB45}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cisco-esw", "src\server\drivers\cisco-esw\cisco-esw.vcproj", "{15B67A25-48BB-4A05-8FF5-9FE747F6D3EB}"
@@ -447,8 +447,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnxsd", "src\agent\libnxs
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dbquery", "src\agent\subagents\dbquery\dbquery.vcproj", "{784D1668-124C-46D9-B985-51276FFA282A}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "appagent", "src\agent\appagent\appagent.vcproj", "{6B249E47-4BAF-4DE2-B62B-C6DD0330753F}"
@@ -458,15 +458,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "appagent", "src\agent\appag
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxappget", "src\agent\tools\nxappget\nxappget.vcproj", "{21D35413-495C-4DD2-BDBF-7BD708C70B74}"
        ProjectSection(ProjectDependencies) = postProject
-               {6B249E47-4BAF-4DE2-B62B-C6DD0330753F} = {6B249E47-4BAF-4DE2-B62B-C6DD0330753F}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {6B249E47-4BAF-4DE2-B62B-C6DD0330753F} = {6B249E47-4BAF-4DE2-B62B-C6DD0330753F}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dlink", "src\server\drivers\dlink\dlink.vcproj", "{45C17A03-3478-4BA4-90B2-F74FE13BFB83}"
        ProjectSection(ProjectDependencies) = postProject
-               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxencpasswd", "src\tools\nxencpasswd\nxencpasswd.vcproj", "{49F5280F-147B-46D0-98BF-931F0646CF82}"
@@ -476,31 +476,31 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxencpasswd", "src\tools\nx
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "symbol-ws", "src\server\drivers\symbol-ws\symbol-ws.vcproj", "{AB4F7846-5024-4666-8F5E-56B2D9FBF55F}"
        ProjectSection(ProjectDependencies) = postProject
-               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dummy", "src\server\smsdrv\dummy\dummy.vcproj", "{60BB5936-BF12-423F-9276-26F179E9C230}"
        ProjectSection(ProjectDependencies) = postProject
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ntws", "src\server\drivers\ntws\ntws.vcproj", "{E614F3CF-58CC-4B7F-9B2D-975921E06522}"
        ProjectSection(ProjectDependencies) = postProject
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
        EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{3AB343C9-A67D-49F1-A8CD-EA0D9CA98467}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "driverloader", "src\server\tools\driverloader\driverloader.vcproj", "{3FE49724-9935-4988-9573-156668B1E20C}"
        ProjectSection(ProjectDependencies) = postProject
-               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "java", "src\agent\subagents\java\java.vcproj", "{4967B29B-4272-4D7B-9CF6-8ABFF9D21348}"
@@ -510,16 +510,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "java", "src\agent\subagents
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ping3", "src\server\drivers\ping3\ping3.vcproj", "{741E8D29-2362-4022-85D6-C1383A413BD6}"
        ProjectSection(ProjectDependencies) = postProject
-               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "at", "src\server\drivers\at\at.vcproj", "{01924916-D158-4370-97C8-D17B8D2A7D4F}"
        ProjectSection(ProjectDependencies) = postProject
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxcproxy", "src\nxcproxy\nxcproxy.vcproj", "{C6F495E0-71D7-4B7E-AC3A-ABBEFBFFD2DF}"
@@ -534,14 +534,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libstrophe", "src\libstroph
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "netsvc", "src\agent\subagents\netsvc\netsvc.vcproj", "{17C5C5F3-3F13-47F4-8606-1EC9B5416DB2}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {406AE5C7-343D-4C88-B8F3-84E46255B830} = {406AE5C7-343D-4C88-B8F3-84E46255B830}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cisco-sb", "src\server\drivers\cisco-sb\cisco-sb.vcproj", "{6D040459-7E6D-44A5-95EE-636853A05033}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "devemu", "src\agent\subagents\devemu\devemu.vcproj", "{BBE9028E-725C-45C6-97C9-BFC443F19DB7}"
@@ -551,47 +551,47 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "devemu", "src\agent\subagen
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "websms", "src\server\smsdrv\websms\websms.vcproj", "{60BB5936-BF12-423F-9276-26F179E9C231}"
        ProjectSection(ProjectDependencies) = postProject
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
        EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "hdlink", "hdlink", "{80EB59BF-5CEC-4248-BF3B-7C30E67063B8}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jira", "src\server\hdlink\jira\jira.vcproj", "{01924916-D158-4370-97C8-D17B8D2A7D4E}"
        ProjectSection(ProjectDependencies) = postProject
-               {12D6E037-84D8-406A-8A9B-3E00D3E0D426} = {12D6E037-84D8-406A-8A9B-3E00D3E0D426}
-               {3B172035-5EEC-45A3-8471-2C390B7ED683} = {3B172035-5EEC-45A3-8471-2C390B7ED683}
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {3B172035-5EEC-45A3-8471-2C390B7ED683} = {3B172035-5EEC-45A3-8471-2C390B7ED683}
+               {12D6E037-84D8-406A-8A9B-3E00D3E0D426} = {12D6E037-84D8-406A-8A9B-3E00D3E0D426}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jansson", "src\jansson\jansson.vcproj", "{12D6E037-84D8-406A-8A9B-3E00D3E0D426}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mikrotik", "src\server\drivers\mikrotik\mikrotik.vcproj", "{500DE9BF-6FC1-4ACB-91AA-308BA1D37F38}"
        ProjectSection(ProjectDependencies) = postProject
-               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "airespace", "src\server\drivers\airespace\airespace.vcproj", "{AB4F7846-5024-4666-8F5E-56B2D9FCF77F}"
        ProjectSection(ProjectDependencies) = postProject
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ubnt", "src\server\drivers\ubnt\ubnt.vcproj", "{500DE9BF-6FC1-4ACB-91AA-308BA2D33F38}"
        ProjectSection(ProjectDependencies) = postProject
-               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "db2", "src\agent\subagents\db2\db2.vcproj", "{90B762AB-B7BA-42D6-9819-C787AB3F59D1}"
        ProjectSection(ProjectDependencies) = postProject
-               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
                {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "filemgr", "src\agent\subagents\filemgr\filemgr.vcproj", "{BBE9028E-725C-45C6-97C9-BFC443F19EA8}"
@@ -606,8 +606,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "src\libpng\libpng
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nxsagent", "src\agent\nxsagent\nxsagent.vcproj", "{9C6790BA-385D-476D-944A-552C87018733}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {C1A5E28A-CF47-4D96-9656-3312F16E3724} = {C1A5E28A-CF47-4D96-9656-3312F16E3724}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{6FC2F162-5E91-47D7-AE00-45C595ED8C85}"
@@ -621,28 +621,28 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "pds-drivers", "pds-drivers"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rrdtool", "src\server\pdsdrv\rrdtool\rrdtool.vcproj", "{1B7CA1B1-C702-49D7-8339-7FF82B188D32}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
-               {3B172035-5EEC-45A3-8471-2C390B7ED683} = {3B172035-5EEC-45A3-8471-2C390B7ED683}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {3B172035-5EEC-45A3-8471-2C390B7ED683} = {3B172035-5EEC-45A3-8471-2C390B7ED683}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "h3c", "src\server\drivers\h3c\h3c.vcproj", "{B51F1406-AF43-4396-96C0-31176DDAA3FC}"
        ProjectSection(ProjectDependencies) = postProject
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-libnxdb", "tests\test-libnxdb\test-libnxdb.vcproj", "{CB4F1D89-AC66-49AF-9273-BA77D39E7707}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {F3E29541-3A0E-45EC-8BEC-E193F2401622} = {F3E29541-3A0E-45EC-8BEC-E193F2401622}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kannel", "src\server\smsdrv\kannel\kannel.vcproj", "{60BB5936-BF12-423F-9276-26F179E9C232}"
        ProjectSection(ProjectDependencies) = postProject
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tuxedo", "src\agent\subagents\tuxedo\tuxedo.vcproj", "{30630D53-7B8E-45CF-BFBB-652D9206ED66}"
@@ -652,9 +652,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tuxedo", "src\agent\subagen
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hpsw", "src\server\drivers\hpsw\hpsw.vcproj", "{B51F1406-AF43-4396-96C0-31176DDCA4FC}"
        ProjectSection(ProjectDependencies) = postProject
-               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
-               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
                {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB} = {7DC90EE4-E31C-4F12-8F1E-81F10E9099FB}
+               {B1745870-F3ED-4ACB-B813-0C4F47EF0793} = {B1745870-F3ED-4ACB-B813-0C4F47EF0793}
+               {CB89D905-C8BE-4027-B2D8-F96C245E9160} = {CB89D905-C8BE-4027-B2D8-F96C245E9160}
        EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libnxclient", "src\client\libnxclient\libnxclient.vcproj", "{B2C8E7C8-E047-46E8-ADDB-0BB819F72288}"
index 60c7d57..d1b05c5 100644 (file)
@@ -1,4 +1,4 @@
-SOURCES = dc.cpp main.cpp session.cpp
+SOURCES = alarms.cpp dc.cpp events.cpp main.cpp objects.cpp session.cpp server.cpp
 
 lib_LTLIBRARIES = libnxclient.la
 
diff --git a/src/client/libnxclient/alarms.cpp b/src/client/libnxclient/alarms.cpp
new file mode 100644 (file)
index 0000000..57a339f
--- /dev/null
@@ -0,0 +1,394 @@
+/*
+** NetXMS - Network Management System
+** Client Library
+** Copyright (C) 2003-2014 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
+** the Free Software Foundation; either version 3 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 Lesser General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+** File: alarms.cpp
+**
+**/
+
+#include "libnxclient.h"
+
+/**
+ * Create alarm comment from NXCP message
+ */
+AlarmComment::AlarmComment(NXCPMessage *msg, UINT32 baseId)
+{
+   m_id = msg->getFieldAsUInt32(baseId);
+   m_alarmId = msg->getFieldAsUInt32(baseId + 1);
+   m_timestamp = (time_t)msg->getFieldAsUInt32(baseId + 2);
+   m_userId = msg->getFieldAsUInt32(baseId + 3);
+   m_text = msg->getFieldAsString(baseId + 4);
+   if (m_text == NULL)
+      m_text = _tcsdup(_T(""));
+   m_userName = msg->getFieldAsString(baseId + 5);
+   if (m_userName == NULL)
+   {
+      m_userName = (TCHAR *)malloc(32 * sizeof(TCHAR));
+      _sntprintf(m_userName, 32, _T("[%u]"), m_userId);
+   }
+}
+
+/**
+ * Destructor for alarm comment
+ */
+AlarmComment::~AlarmComment()
+{
+   free(m_text);
+}
+
+/**
+ * Acknowledge alarm
+ */
+UINT32 AlarmController::acknowledge(UINT32 alarmId, bool sticky, UINT32 timeout)
+{
+   NXCPMessage msg;
+   msg.setId(m_session->createMessageId());
+   msg.setCode(CMD_ACK_ALARM);
+   msg.setField(VID_ALARM_ID, alarmId);
+   msg.setField(VID_STICKY_FLAG, (UINT16)(sticky ? 1 : 0));
+   msg.setField(VID_TIMESTAMP, timeout);
+
+   if (!m_session->sendMessage(&msg))
+      return RCC_COMM_FAILURE;
+
+   return m_session->waitForRCC(msg.getId());
+}
+
+/**
+ * Resolve alarm
+ */
+UINT32 AlarmController::resolve(UINT32 alarmId)
+{
+   NXCPMessage msg;
+   msg.setId(m_session->createMessageId());
+   msg.setCode(CMD_RESOLVE_ALARM);
+   msg.setField(VID_ALARM_ID, alarmId);
+
+   if (!m_session->sendMessage(&msg))
+      return RCC_COMM_FAILURE;
+
+   return m_session->waitForRCC(msg.getId());
+}
+
+/**
+ * Terminate alarm
+ */
+UINT32 AlarmController::terminate(UINT32 alarmId)
+{
+   NXCPMessage msg;
+   msg.setId(m_session->createMessageId());
+   msg.setCode(CMD_TERMINATE_ALARM);
+   msg.setField(VID_ALARM_ID, alarmId);
+
+   if (!m_session->sendMessage(&msg))
+      return RCC_COMM_FAILURE;
+
+   return m_session->waitForRCC(msg.getId());
+}
+
+/**
+ * Open helpdesk issue
+ *
+ * @param aarmId alarm ID
+ * @param helpdeskRef buffer for helpdesk reference. Must be at least MAX_HELPDESK_REF_LEN characters long.
+ */
+UINT32 AlarmController::openHelpdeskIssue(UINT32 alarmId, TCHAR *helpdeskRef)
+{
+   NXCPMessage msg;
+
+   msg.setCode(CMD_OPEN_HELPDESK_ISSUE);
+   msg.setId(m_session->createMessageId());
+   msg.setField(VID_ALARM_ID, alarmId);
+   if (!m_session->sendMessage(&msg))
+      return RCC_COMM_FAILURE;
+
+   UINT32 rcc;
+   NXCPMessage *response = m_session->waitForMessage(CMD_REQUEST_COMPLETED, msg.getId());
+   if (response != NULL)
+   {
+      rcc = response->getFieldAsUInt32(VID_RCC);
+      if (rcc == RCC_SUCCESS)
+      {
+         helpdeskRef[0] = 0;
+         response->getFieldAsString(VID_HELPDESK_REF, helpdeskRef, MAX_HELPDESK_REF_LEN);
+      }
+      delete response;
+   }
+   else
+   {
+      rcc = RCC_TIMEOUT;
+   }
+   return rcc;
+}
+
+/**
+ * Update alarm comment
+ */
+UINT32 AlarmController::updateComment(UINT32 alarmId, UINT32 commentId, const TCHAR *text)
+{
+   NXCPMessage msg;
+
+   msg.setCode(CMD_UPDATE_ALARM_COMMENT);
+   msg.setId(m_session->createMessageId());
+   msg.setField(VID_ALARM_ID, alarmId);
+   msg.setField(VID_COMMENT_ID, commentId);
+   msg.setField(VID_COMMENTS, text);
+   if (!m_session->sendMessage(&msg))
+      return RCC_COMM_FAILURE;
+
+   return m_session->waitForRCC(msg.getId());
+}
+
+/**
+ * Add alarm comment
+ */
+UINT32 AlarmController::addComment(UINT32 alarmId, const TCHAR *text)
+{
+   return updateComment(alarmId, 0, text);
+}
+
+/**
+ * Get alarm comments
+ *
+ * Comments array must be deleted by the caller.
+ */
+UINT32 AlarmController::getComments(UINT32 alarmId, ObjectArray<AlarmComment> **comments)
+{
+   NXCPMessage msg;
+
+   *comments = NULL;
+
+   msg.setCode(CMD_GET_ALARM_COMMENTS);
+   msg.setId(m_session->createMessageId());
+   msg.setField(VID_ALARM_ID, alarmId);
+   if (!m_session->sendMessage(&msg))
+      return RCC_COMM_FAILURE;
+
+   UINT32 rcc;
+   NXCPMessage *response = m_session->waitForMessage(CMD_REQUEST_COMPLETED, msg.getId());
+   if (response != NULL)
+   {
+      rcc = response->getFieldAsUInt32(VID_RCC);
+      if (rcc == RCC_SUCCESS)
+      {
+         int count = response->getFieldAsInt32(VID_NUM_ELEMENTS);
+         ObjectArray<AlarmComment> *list = new ObjectArray<AlarmComment>(count, 16, true);
+         UINT32 fieldId = VID_ELEMENT_LIST_BASE;
+         for(int i = 0; i < count; i++)
+         {
+            list->add(new AlarmComment(response, fieldId));
+            fieldId += 10;
+         }
+         *comments = list;
+      }
+      delete response;
+   }
+   else
+   {
+      rcc = RCC_TIMEOUT;
+   }
+   return rcc;
+}
+
+/**
+ * Load all alarms from server. Returned array must be destroyed by caller.
+ */
+UINT32 AlarmController::getAll(ObjectArray<NXC_ALARM> **alarms)
+{
+   *alarms = NULL;
+
+   NXCPMessage msg;
+   msg.setCode(CMD_GET_ALL_ALARMS);
+   msg.setId(m_session->createMessageId());
+   if (!m_session->sendMessage(&msg))
+      return RCC_COMM_FAILURE;
+
+   ObjectArray<NXC_ALARM> *list = new ObjectArray<NXC_ALARM>(256, 256, true);
+   UINT32 alarmId;
+   UINT32 rcc = RCC_SUCCESS;
+   do
+   {
+      NXCPMessage *response = m_session->waitForMessage(CMD_ALARM_DATA, msg.getId());
+      if (response != NULL)
+      {
+         alarmId = response->getFieldAsUInt32(VID_ALARM_ID);
+         if (alarmId != 0)  // 0 is end of list indicator
+         {
+            NXC_ALARM *alarm = createAlarmFromMessage(response);
+            list->add(alarm);
+         }
+         delete response;
+      }
+      else
+      {
+         rcc = RCC_TIMEOUT;
+         alarmId = 0;
+      }
+   }
+   while(alarmId != 0);
+
+   // Destroy results on failure or save on success
+   if (rcc == RCC_SUCCESS)
+   {
+      *alarms = list;
+   }
+   else
+   {
+      delete list;
+   }
+
+   return rcc;
+}
+
+/**
+ * Create alarm record from NXCP message
+ */
+NXC_ALARM *AlarmController::createAlarmFromMessage(NXCPMessage *msg)
+{
+   NXC_ALARM *alarm = new NXC_ALARM();
+   alarm->dwAlarmId = msg->getFieldAsUInt32(VID_ALARM_ID);
+   alarm->dwAckByUser = msg->getFieldAsUInt32(VID_ACK_BY_USER);
+   alarm->dwResolvedByUser = msg->getFieldAsUInt32(VID_RESOLVED_BY_USER);
+   alarm->dwTermByUser = msg->getFieldAsUInt32(VID_TERMINATED_BY_USER);
+   alarm->qwSourceEventId = msg->getFieldAsUInt64(VID_EVENT_ID);
+   alarm->dwSourceEventCode = msg->getFieldAsUInt32(VID_EVENT_CODE);
+   alarm->dwSourceObject = msg->getFieldAsUInt32(VID_OBJECT_ID);
+   alarm->dwCreationTime = msg->getFieldAsUInt32(VID_CREATION_TIME);
+   alarm->dwLastChangeTime = msg->getFieldAsUInt32(VID_LAST_CHANGE_TIME);
+   msg->getFieldAsString(VID_ALARM_KEY, alarm->szKey, MAX_DB_STRING);
+       msg->getFieldAsString(VID_ALARM_MESSAGE, alarm->szMessage, MAX_EVENT_MSG_LENGTH);
+   alarm->nState = (BYTE)msg->getFieldAsUInt16(VID_STATE);
+   alarm->nCurrentSeverity = (BYTE)msg->getFieldAsUInt16(VID_CURRENT_SEVERITY);
+   alarm->nOriginalSeverity = (BYTE)msg->getFieldAsUInt16(VID_ORIGINAL_SEVERITY);
+   alarm->dwRepeatCount = msg->getFieldAsUInt32(VID_REPEAT_COUNT);
+   alarm->nHelpDeskState = (BYTE)msg->getFieldAsUInt16(VID_HELPDESK_STATE);
+   msg->getFieldAsString(VID_HELPDESK_REF, alarm->szHelpDeskRef, MAX_HELPDESK_REF_LEN);
+       alarm->dwTimeout = msg->getFieldAsUInt32(VID_ALARM_TIMEOUT);
+       alarm->dwTimeoutEvent = msg->getFieldAsUInt32(VID_ALARM_TIMEOUT_EVENT);
+       alarm->noteCount = msg->getFieldAsUInt32(VID_NUM_COMMENTS);
+   alarm->pUserData = NULL;
+   return alarm;
+}
+
+/**
+ * Format text from alarm data
+ * Valid format specifiers are following:
+ *             %a Primary IP address of source object
+ *             %A Primary host name of source object
+ *    %c Repeat count
+ *    %e Event code
+ *    %E Event name
+ *    %h Helpdesk state as number
+ *    %H Helpdesk state as text
+ *    %i Source object identifier
+ *    %I Alarm identifier
+ *    %m Message text
+ *    %n Source object name
+ *    %s Severity as number
+ *    %S Severity as text
+ *    %x Alarm state as number
+ *    %X Alarm state as text
+ *    %% Percent sign
+ */
+TCHAR *AlarmController::formatAlarmText(NXC_ALARM *alarm, const TCHAR *format)
+{
+       static const TCHAR *alarmState[] = { _T("OUTSTANDING"), _T("ACKNOWLEDGED"), _T("TERMINATED") };
+       static const TCHAR *helpdeskState[] = { _T("IGNORED"), _T("OPEN"), _T("CLOSED") };
+       static const TCHAR *severityText[] = { _T("NORMAL"), _T("WARNING"), _T("MINOR"), _T("MAJOR"), _T("CRITICAL") };
+
+   ObjectController *oc = (ObjectController *)m_session->getController(CONTROLLER_OBJECTS);
+   AbstractObject *object = oc->findObjectById(alarm->dwSourceObject);
+   if (object == NULL)
+   {
+          oc->syncSingleObject(alarm->dwSourceObject);
+          object = oc->findObjectById(alarm->dwSourceObject);
+   }
+
+       String out;
+       const TCHAR *prev, *curr;
+   TCHAR buffer[128];
+       for(prev = format; *prev != 0; prev = curr)
+       {
+               curr = _tcschr(prev, _T('%'));
+               if (curr == NULL)
+               {
+                       out += prev;
+                       break;
+               }
+               out.addString(prev, (UINT32)(curr - prev));
+               curr++;
+               switch(*curr)
+               {
+                       case '%':
+                               out += _T("%");
+                               break;
+                       case 'a':
+            out += (object != NULL) ? object->getPrimaryIP().toString(buffer) : _T("<unknown>");
+                               break;
+                       case 'A':
+            out += ((object != NULL) && (object->getObjectClass() == OBJECT_NODE)) ? ((Node *)object)->getPrimaryHostname() : _T("<unknown>");
+                               break;
+                       case 'c':
+                               out.addFormattedString(_T("%u"), (unsigned int)alarm->dwRepeatCount);
+                               break;
+                       case 'e':
+                               out.addFormattedString(_T("%u"), (unsigned int)alarm->dwSourceEventCode);
+                               break;
+                       case 'E':
+            out += ((EventController *)m_session->getController(CONTROLLER_EVENTS))->getEventName(alarm->dwSourceEventCode, buffer, 128);
+                               break;
+                       case 'h':
+                               out.addFormattedString(_T("%d"), (int)alarm->nHelpDeskState);
+                               break;
+                       case 'H':
+                               out += helpdeskState[alarm->nHelpDeskState];
+                               break;
+                       case 'i':
+                               out.addFormattedString(_T("%u"), (unsigned int)alarm->dwSourceObject);
+                               break;
+                       case 'I':
+                               out.addFormattedString(_T("%u"), (unsigned int)alarm->dwAlarmId);
+                               break;
+                       case 'm':
+                               out += alarm->szMessage;
+                               break;
+                       case 'n':
+                               out += (object != NULL) ? object->getName() : _T("<unknown>");
+                               break;
+                       case 's':
+                               out.addFormattedString(_T("%d"), (int)alarm->nCurrentSeverity);
+                               break;
+                       case 'S':
+                               out += severityText[alarm->nCurrentSeverity];
+                               break;
+                       case 'x':
+                               out.addFormattedString(_T("%d"), (int)alarm->nState);
+                               break;
+                       case 'X':
+                               out += alarmState[alarm->nState];
+                               break;
+                       case 0:
+                               curr--;
+                               break;
+                       default:
+                               break;
+               }
+               curr++;
+       }
+       return _tcsdup((const TCHAR *)out);
+}
diff --git a/src/client/libnxclient/events.cpp b/src/client/libnxclient/events.cpp
new file mode 100644 (file)
index 0000000..b861ff6
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+** NetXMS - Network Management System
+** Client Library
+** Copyright (C) 2003-2014 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
+** the Free Software Foundation; either version 3 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 Lesser General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+** File: events.cpp
+**
+**/
+
+#include "libnxclient.h"
+
+/**
+ * Controller constructor
+ */
+EventController::EventController(NXCSession *session) : Controller(session)
+{
+   m_eventTemplates = NULL;
+   m_eventTemplateLock = MutexCreate();
+}
+
+/**
+ * Controller destructor
+ */
+EventController::~EventController()
+{
+   delete m_eventTemplates;
+   MutexDestroy(m_eventTemplateLock);
+}
+
+/**
+ * Synchronize event templates
+ */
+UINT32 EventController::syncEventTemplates()
+{
+   ObjectArray<EventTemplate> *list = new ObjectArray<EventTemplate>(256, 256, true);
+   UINT32 rcc = getEventTemplates(list);
+   if (rcc != RCC_SUCCESS)
+   {
+      delete list;
+      return rcc;
+   }
+
+   MutexLock(m_eventTemplateLock);
+   delete m_eventTemplates;
+   m_eventTemplates = list;
+   MutexUnlock(m_eventTemplateLock);
+   return RCC_SUCCESS;
+}
+
+/**
+ * Get configured event templates
+ */
+UINT32 EventController::getEventTemplates(ObjectArray<EventTemplate> *templates)
+{
+   NXCPMessage msg;
+   msg.setCode(CMD_LOAD_EVENT_DB);
+   msg.setId(m_session->createMessageId());
+
+   if (!m_session->sendMessage(&msg))
+      return RCC_COMM_FAILURE;
+
+   UINT32 rcc = m_session->waitForRCC(msg.getId());
+   if (rcc != RCC_SUCCESS)
+      return rcc;
+
+   while(true)
+   {
+      NXCPMessage *response = m_session->waitForMessage(CMD_EVENT_DB_RECORD, msg.getId());
+      if (response != NULL)
+      {
+         if (response->isEndOfSequence())
+         {
+            delete response;
+            break;
+         }
+         templates->add(new EventTemplate(response));
+         delete response;
+      }
+      else
+      {
+         rcc = RCC_TIMEOUT;
+         break;
+      }
+   }
+   return rcc;
+}
+
+/**
+ * Get event name by code
+ */
+TCHAR *EventController::getEventName(UINT32 code, TCHAR *buffer, size_t bufferSize)
+{
+   MutexLock(m_eventTemplateLock);
+   if (m_eventTemplates != NULL)
+   {
+      for(int i = 0; i < m_eventTemplates->size(); i++)
+      {
+         EventTemplate *t = m_eventTemplates->get(i);
+         if (t->getCode() == code)
+         {
+            nx_strncpy(buffer, t->getName(), bufferSize);
+            MutexUnlock(m_eventTemplateLock);
+            return buffer;
+         }
+      }
+   }
+   MutexUnlock(m_eventTemplateLock);
+   nx_strncpy(buffer, _T("<unknown>"), bufferSize);
+   return buffer;
+}
+
+/**
+ * Send event to server
+ */
+UINT32 EventController::sendEvent(UINT32 code, const TCHAR *name, UINT32 objectId, int argc, TCHAR **argv, const TCHAR *userTag)
+{
+   NXCPMessage msg;
+
+   msg.setCode(CMD_TRAP);
+   msg.setId(m_session->createMessageId());
+   msg.setField(VID_EVENT_CODE, code);
+   msg.setField(VID_EVENT_NAME, name);
+   msg.setField(VID_OBJECT_ID, objectId);
+       msg.setField(VID_USER_TAG, CHECK_NULL_EX(userTag));
+   msg.setField(VID_NUM_ARGS, (UINT16)argc);
+   for(int i = 0; i < argc; i++)
+      msg.setField(VID_EVENT_ARG_BASE + i, argv[i]);
+
+   if (!m_session->sendMessage(&msg))
+      return RCC_COMM_FAILURE;
+   return m_session->waitForRCC(msg.getId());
+}
+
+/**
+ * Event template constructor
+ */
+EventTemplate::EventTemplate(NXCPMessage *msg)
+{
+   m_code = msg->getFieldAsUInt32(VID_EVENT_CODE);
+   msg->getFieldAsString(VID_NAME, m_name, MAX_EVENT_NAME);
+   m_severity = msg->getFieldAsInt32(VID_SEVERITY);
+   m_flags = msg->getFieldAsUInt32(VID_FLAGS);
+   m_messageTemplate = msg->getFieldAsString(VID_MESSAGE);
+   m_description = msg->getFieldAsString(VID_DESCRIPTION);
+}
+
+/**
+ * Event template destructor
+ */
+EventTemplate::~EventTemplate()
+{
+   safe_free(m_messageTemplate);
+   safe_free(m_description);
+}
index 33d06a1..b6e4232 100644 (file)
                        Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
                        UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
                        >
+                       <File
+                               RelativePath=".\alarms.cpp"
+                               >
+                       </File>
                        <File
                                RelativePath=".\dc.cpp"
                                >
                        </File>
+                       <File
+                               RelativePath=".\events.cpp"
+                               >
+                       </File>
                        <File
                                RelativePath=".\main.cpp"
                                >
                        </File>
+                       <File
+                               RelativePath=".\objects.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\server.cpp"
+                               >
+                       </File>
                        <File
                                RelativePath=".\session.cpp"
                                >
                                RelativePath="..\..\..\include\nxclient.h"
                                >
                        </File>
+                       <File
+                               RelativePath="..\..\..\include\nxclobj.h"
+                               >
+                       </File>
                        <File
                                RelativePath="..\..\..\include\nxcpapi.h"
                                >
diff --git a/src/client/libnxclient/objects.cpp b/src/client/libnxclient/objects.cpp
new file mode 100644 (file)
index 0000000..465dc69
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+** NetXMS - Network Management System
+** Client Library
+** Copyright (C) 2003-2014 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
+** the Free Software Foundation; either version 3 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 Lesser General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+** File: objects.cpp
+**
+**/
+
+#include "libnxclient.h"
+#include <uthash.h>
+
+/**
+ * Object cache entry
+ */
+struct ObjectCacheEntry
+{
+   UT_hash_handle hh;
+   UINT32 id;
+   AbstractObject *object;
+};
+
+/**
+ * Controller constructor
+ */
+ObjectController::ObjectController(NXCSession *session) : Controller(session)
+{
+   m_cache = NULL;
+   m_cacheLock = MutexCreate();
+}
+
+/**
+ * Controller destructor
+ */
+ObjectController::~ObjectController()
+{
+   ObjectCacheEntry *entry, *tmp;
+   HASH_ITER(hh, m_cache, entry, tmp)
+   {
+      HASH_DEL(m_cache, entry);
+      entry->object->decRefCount();
+      free(entry);
+   }
+   MutexDestroy(m_cacheLock);
+}
+
+/**
+ * Sync all objects
+ */
+UINT32 ObjectController::sync()
+{
+   return RCC_NOT_IMPLEMENTED;
+}
+
+/**
+ * Sync object set
+ */
+UINT32 ObjectController::syncObjectSet(UINT32 *idList, size_t length, bool syncComments, UINT16 flags)
+{
+   // Build request message
+   NXCPMessage msg;
+   msg.setCode(CMD_GET_SELECTED_OBJECTS);
+   msg.setId(m_session->createMessageId());
+       msg.setField(VID_SYNC_COMMENTS, (WORD)(syncComments ? 1 : 0));
+       msg.setField(VID_FLAGS, (WORD)(flags | OBJECT_SYNC_SEND_UPDATES));      // C library requres objects to go in update messages
+   msg.setField(VID_NUM_OBJECTS, length);
+       msg.setFieldFromInt32Array(VID_OBJECT_LIST, length, idList);
+
+   // Send request
+   if (!m_session->sendMessage(&msg))
+      return RCC_COMM_FAILURE;
+
+   // Wait for reply
+   UINT32 rcc = m_session->waitForRCC(msg.getId());
+       if ((rcc == RCC_SUCCESS) && (flags & OBJECT_SYNC_DUAL_CONFIRM))
+       {
+      rcc = m_session->waitForRCC(msg.getId());
+       }
+       return rcc;
+}
+
+/**
+ * Synchronize single object
+ * Simple wrapper for syncObjectSet which syncs comments and waits for sync completion
+ */
+UINT32 ObjectController::syncSingleObject(UINT32 id)
+{
+       return syncObjectSet(&id, 1, true, OBJECT_SYNC_DUAL_CONFIRM);
+}
+
+/**
+ * Find object by ID.
+ * Caller must decrease reference count for object.
+ */
+AbstractObject *ObjectController::findObjectById(UINT32 id)
+{
+   AbstractObject *object = NULL;
+   MutexLock(m_cacheLock);
+   ObjectCacheEntry *entry;
+   HASH_FIND_INT(m_cache, &id, entry);
+   if (entry != NULL)
+   {
+      object = entry->object;
+      object->incRefCount();
+   }
+   MutexUnlock(m_cacheLock);
+   return object;
+}
+
+/**
+ * Abstract object constructor
+ */
+AbstractObject::AbstractObject(NXCPMessage *msg)
+{
+   m_id = msg->getFieldAsUInt32(VID_OBJECT_ID);
+   msg->getFieldAsBinary(VID_GUID, m_guid, UUID_LENGTH);
+   m_class = msg->getFieldAsInt16(VID_OBJECT_CLASS);
+   msg->getFieldAsString(VID_OBJECT_NAME, m_name, MAX_OBJECT_NAME);
+   m_status = msg->getFieldAsInt16(VID_OBJECT_STATUS);
+   m_primaryIP = msg->getFieldAsInetAddress(VID_IP_ADDRESS);
+   m_comments = msg->getFieldAsString(VID_COMMENTS);
+   m_geoLocation = GeoLocation(*msg);
+   m_submapId = msg->getFieldAsUInt32(VID_SUBMAP_ID);
+
+       // Custom attributes
+       int count = msg->getFieldAsInt32(VID_NUM_CUSTOM_ATTRIBUTES);
+   UINT32 id = VID_CUSTOM_ATTRIBUTES_BASE;
+       for(int i = 0; i < count; i++, id += 2)
+       {
+               m_customAttributes.setPreallocated(msg->getFieldAsString(id), msg->getFieldAsString(id + 1));
+       }
+
+   // Parents
+       count = msg->getFieldAsInt32(VID_PARENT_CNT);
+   m_parents = new IntegerArray<UINT32>(count);
+   id = VID_PARENT_ID_BASE;
+       for(int i = 0; i < count; i++, id++)
+      m_parents->add(msg->getFieldAsUInt32(id));
+
+   // Children
+       count = msg->getFieldAsInt32(VID_CHILD_CNT);
+   m_children = new IntegerArray<UINT32>(count);
+   id = VID_CHILD_ID_BASE;
+       for(int i = 0; i < count; i++, id++)
+      m_children->add(msg->getFieldAsUInt32(id));
+}
+
+/**
+ * Abstract object destructor
+ */
+AbstractObject::~AbstractObject()
+{
+   safe_free(m_comments);
+   delete m_parents;
+   delete m_children;
+}
+
+/** 
+ * Node constructor
+ */
+Node::Node(NXCPMessage *msg) : AbstractObject(msg)
+{
+   m_primaryHostname = msg->getFieldAsString(VID_PRIMARY_NAME);
+}
+
+/**
+ * Node destructor
+ */
+Node::~Node()
+{
+   safe_free(m_primaryHostname);
+}
diff --git a/src/client/libnxclient/server.cpp b/src/client/libnxclient/server.cpp
new file mode 100644 (file)
index 0000000..82c4bf1
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+** NetXMS - Network Management System
+** Client Library
+** Copyright (C) 2003-2014 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
+** the Free Software Foundation; either version 3 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 Lesser General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+** File: server.cpp
+**
+**/
+
+#include "libnxclient.h"
+
+/**
+ * Send SMS from server
+ */
+UINT32 ServerController::sendSMS(const TCHAR *recipient, const TCHAR *text)
+{
+   NXCPMessage msg;
+
+   msg.setCode(CMD_SEND_SMS);
+   msg.setId(m_session->createMessageId());
+   msg.setField(VID_RCPT_ADDR, recipient);
+   msg.setField(VID_MESSAGE, text);
+
+   if (!m_session->sendMessage(&msg))
+      return RCC_COMM_FAILURE;
+   return m_session->waitForRCC(msg.getId());
+}
index 3f778ec..136fa72 100644 (file)
  */
 #define MAX_MSG_SIZE    4194304
 
+/**
+ * Default controller destructor
+ */
+Controller::~Controller()
+{
+}
+
 /**
  * Constructor
  */
@@ -78,6 +85,8 @@ Controller *NXCSession::getController(const TCHAR *name)
          c = new EventController(this);
       else if (!_tcsicmp(name, CONTROLLER_OBJECTS))
          c = new ObjectController(this);
+      else if (!_tcsicmp(name, CONTROLLER_SERVER))
+         c = new ServerController(this);
 
       if (c != NULL)
          m_controllers->set(name, c);
index fa8b1d4..6f93bbd 100644 (file)
@@ -31,26 +31,26 @@ static TCHAR m_outFormat[MAX_DB_STRING] = _T("%I %S %H %m");
 /**
  * List alarms
  */
-static UINT32 ListAlarms(NXC_SESSION session)
+static UINT32 ListAlarms(NXCSession *session)
 {
-       UINT32 i, numAlarms, rcc;
-       NXC_ALARM *alarmList;
-       TCHAR *text;
-
-       rcc = NXCLoadEventDB(session);
+       UINT32 rcc = ((EventController *)session->getController(CONTROLLER_EVENTS))->syncEventTemplates();
        if (rcc != RCC_SUCCESS)
                _tprintf(_T("WARNING: cannot load event database (%s)\n"), NXCGetErrorText(rcc));
 
-       rcc = NXCLoadAllAlarms(session, &numAlarms, &alarmList);
+   AlarmController *ctrl = (AlarmController *)session->getController(CONTROLLER_ALARMS);
+
+   ObjectArray<NXC_ALARM> *alarms;
+   rcc = ctrl->getAll(&alarms);
        if (rcc == RCC_SUCCESS)
        {
-               for(i = 0; i < numAlarms; i++)
+      for(int i = 0; i < alarms->size(); i++)
                {
-                       text = NXCFormatAlarmText(session, &alarmList[i], m_outFormat);
+         TCHAR *text = ctrl->formatAlarmText(alarms->get(i), m_outFormat);
                        _tprintf(_T("%s\n"), text);
                        free(text);
                }
-               _tprintf(_T("\n%d active alarms\n"), numAlarms);
+      _tprintf(_T("\n%d active alarms\n"), alarms->size());
+      delete alarms;
        }
        else
        {
@@ -62,9 +62,9 @@ static UINT32 ListAlarms(NXC_SESSION session)
 /**
  * Callback function for debug printing
  */
-static void DebugCallback(TCHAR *pMsg)
+static void DebugCallback(const TCHAR *pMsg)
 {
-   _tprintf(_T("*debug* %s\n"), pMsg);
+   _tprintf(_T("NXCL: %s\n"), pMsg);
 }
 
 #ifdef _WIN32
@@ -84,7 +84,6 @@ int main(int argc, char *argv[])
        bool isDebug = false, isEncrypt = false, isSticky = false;
        UINT32 rcc, alarmId;
    int timeout = 3, ackTimeout = 0;
-   NXC_SESSION session;
        int ch;
 
    // Parse command line
@@ -101,6 +100,7 @@ int main(int argc, char *argv[])
                                                 "   get-comments <id>       : Get comments of alarm\n"
                                                 "   list                    : List active alarms\n"
                                                 "   open <id>               : Open helpdesk issue from alarm\n"
+                                                "   resolve <id>            : Resolve alarm\n"
                                                 "   terminate <id>          : Terminate alarm\n"
                    "Valid options are:\n"
 #ifndef _WIN32
@@ -242,16 +242,17 @@ int main(int argc, char *argv[])
 #else
 #define _HOST argv[optind]
 #endif
-       rcc = NXCConnect(isEncrypt ? NXCF_ENCRYPT : 0, _HOST, login,
-                             password, 0, NULL, NULL, &session,
-                    _T("nxalarm/") NETXMS_VERSION_STRING, NULL);
+
+   NXCSession *session = new NXCSession();
+   rcc = session->connect(_HOST, login, password, isEncrypt ? NXCF_ENCRYPT : 0, _T("nxalarm/") NETXMS_VERSION_STRING);
        if (rcc != RCC_SUCCESS)
        {
                _tprintf(_T("Unable to connect to server: %s\n"), NXCGetErrorText(rcc));
+      delete session;
                return 2;
        }
 
-       NXCSetCommandTimeout(session, (UINT32)timeout * 1000);
+       session->setCommandTimeout((UINT32)timeout * 1000);
 
        // Execute command
        if (!stricmp(argv[optind + 1], "list"))
@@ -264,13 +265,14 @@ int main(int argc, char *argv[])
                if ((*eptr != 0) || (alarmId == 0))
                {
                        _tprintf(_T("Invalid alarm ID \"%hs\"\n"), argv[optind + 2]);
-                       NXCDisconnect(session);
+         delete session;
                        return 1;
                }
 
+      AlarmController *ctrl = (AlarmController *)session->getController(CONTROLLER_ALARMS);
                if (!stricmp(argv[optind + 1], "ack"))
                {
-                  rcc = NXCAcknowledgeAlarmEx(session, alarmId, isSticky, (UINT32)ackTimeout * 60);
+         rcc = ctrl->acknowledge(alarmId, isSticky, (UINT32)ackTimeout * 60);
                        if (rcc != RCC_SUCCESS)
                                _tprintf(_T("Cannot acknowledge alarm: %s\n"), NXCGetErrorText(rcc));
                }
@@ -278,10 +280,10 @@ int main(int argc, char *argv[])
                {
 #ifdef UNICODE
          WCHAR *wtext = WideStringFromMBString(argv[optind + 3]);
-                       rcc = NXCAddAlarmComment(session, alarmId, wtext);
+         rcc = ctrl->addComment(alarmId, wtext);
          free(wtext);
 #else
-                       rcc = NXCAddAlarmComment(session, alarmId, argv[optind + 3]);
+                       rcc = ctrl->addComment(alarmId, argv[optind + 3]);
 #endif
                        if (rcc != RCC_SUCCESS)
                                _tprintf(_T("Cannot add alarm comment: %s\n"), NXCGetErrorText(rcc));
@@ -289,7 +291,7 @@ int main(int argc, char *argv[])
                else if (!stricmp(argv[optind + 1], "get-comments"))
                {
          ObjectArray<AlarmComment> *comments;
-         rcc = NXCGetAlarmComments(session, alarmId, &comments);
+         rcc = ctrl->getComments(alarmId, &comments);
          if (rcc == RCC_SUCCESS)
          {
             for(int i = 0; i < comments->size(); i++)
@@ -311,26 +313,32 @@ int main(int argc, char *argv[])
                else if (!stricmp(argv[optind + 1], "open"))
                {
          TCHAR hdref[MAX_HELPDESK_REF_LEN];
-                       rcc = NXCOpenHelpdeskIssue(session, alarmId, hdref);
+                       rcc = ctrl->openHelpdeskIssue(alarmId, hdref);
                        if (rcc == RCC_SUCCESS)
                                _tprintf(_T("Helpdesk issue open, reference ID is \"%s\"\n"), hdref);
          else
                                _tprintf(_T("Cannot open helpdesk issue: %s\n"), NXCGetErrorText(rcc));
                }
+               else if (!stricmp(argv[optind + 1], "resolve"))
+               {
+         rcc = ctrl->resolve(alarmId);
+                       if (rcc != RCC_SUCCESS)
+                               _tprintf(_T("Cannot resolve alarm: %s\n"), NXCGetErrorText(rcc));
+               }
                else if (!stricmp(argv[optind + 1], "terminate"))
                {
-                       rcc = NXCTerminateAlarm(session, alarmId);
+         rcc = ctrl->terminate(alarmId);
                        if (rcc != RCC_SUCCESS)
                                _tprintf(_T("Cannot terminate alarm: %s\n"), NXCGetErrorText(rcc));
                }
                else
                {
                        _tprintf(_T("Invalid command \"%hs\"\n"), argv[optind + 1]);
-                       NXCDisconnect(session);
+                       delete session;
                        return 1;
                }
        }
 
-   NXCDisconnect(session);
+   delete session;
        return (rcc == RCC_SUCCESS) ? 0 : 5;
 }
index ee1a55b..f523db6 100644 (file)
@@ -25,7 +25,7 @@
 #define _nxalarm_h_
 
 #include <nms_common.h>
-#include <nxclapi.h>
+#include <nxclient.h>
 
 #if HAVE_GETOPT_H
 #include <getopt.h>
index 2dc3744..d4dfba4 100644 (file)
@@ -39,7 +39,7 @@ static DWORD m_dwTimeOut = 3;
 /**
  * Callback function for debug printing
  */
-static void DebugCallback(TCHAR *pMsg)
+static void DebugCallback(const TCHAR *pMsg)
 {
    _tprintf(_T("*debug* %s\n"), pMsg);
 }
@@ -50,7 +50,6 @@ static void DebugCallback(TCHAR *pMsg)
 static DWORD SendEvent(int iNumArgs, char **pArgList, BOOL bEncrypt)
 {
    DWORD dwResult;
-   NXC_SESSION hSession;
 
    if (!NXCInitialize())
    {
@@ -61,31 +60,31 @@ static DWORD SendEvent(int iNumArgs, char **pArgList, BOOL bEncrypt)
       if (m_bDebug)
          NXCSetDebugCallback(DebugCallback);
 
-      dwResult = NXCConnect(bEncrypt ? NXCF_ENCRYPT : 0, m_szServer, m_szLogin,
-                                     m_szPassword, 0, NULL, NULL, &hSession,
-                            _T("nxevent/") NETXMS_VERSION_STRING, NULL);
+      NXCSession *session = new NXCSession();
+      dwResult = session->connect(m_szServer, m_szLogin, m_szPassword, bEncrypt ? NXCF_ENCRYPT : 0, _T("nxevent/") NETXMS_VERSION_STRING);
       if (dwResult != RCC_SUCCESS)
       {
          _tprintf(_T("Unable to connect to server: %s\n"), NXCGetErrorText(dwResult));
       }
       else
       {
-         NXCSetCommandTimeout(hSession, m_dwTimeOut * 1000);
+         session->setCommandTimeout(m_dwTimeOut * 1000);
+         EventController *ctrl = (EventController *)session->getController(CONTROLLER_EVENTS);
 #ifdef UNICODE
                        WCHAR **argList = (WCHAR **)malloc(sizeof(WCHAR *) * iNumArgs);
                        for(int i = 0; i < iNumArgs; i++)
                                argList[i] = WideStringFromMBString(pArgList[i]);
-         dwResult = NXCSendEvent(hSession, m_dwEventCode, m_eventName, m_dwObjectId, iNumArgs, argList, m_szUserTag);
+         dwResult = ctrl->sendEvent(m_dwEventCode, m_eventName, m_dwObjectId, iNumArgs, argList, m_szUserTag);
                        for(int i = 0; i < iNumArgs; i++)
                                free(argList[i]);
                        free(argList);
 #else
-         dwResult = NXCSendEvent(hSession, m_dwEventCode, m_eventName, m_dwObjectId, iNumArgs, pArgList, m_szUserTag);
+         dwResult = ctrl->sendEvent(m_dwEventCode, m_eventName, m_dwObjectId, iNumArgs, pArgList, m_szUserTag);
 #endif
          if (dwResult != RCC_SUCCESS)
             _tprintf(_T("Unable to send event: %s\n"), NXCGetErrorText(dwResult));
-         NXCDisconnect(hSession);
       }
+      delete session;
    }
    return dwResult;
 }
index a57a63b..8f28252 100644 (file)
@@ -25,7 +25,7 @@
 #define _nxevent_h_
 
 #include <nms_common.h>
-#include <nxclapi.h>
+#include <nxclient.h>
 
 #if HAVE_GETOPT_H
 #include <getopt.h>
index d5aab53..3347111 100644 (file)
@@ -26,9 +26,9 @@
 /**
  * Callback function for debug printing
  */
-static void DebugCallback(TCHAR *pMsg)
+static void DebugCallback(const TCHAR *pMsg)
 {
-   _tprintf(_T("*debug* %s\n"), pMsg);
+   _tprintf(_T("NXCL: %s\n"), pMsg);
 }
 
 #ifdef _WIN32
@@ -45,7 +45,6 @@ int main(int argc, char *argv[])
        TCHAR login[MAX_DB_STRING] = _T("guest"), password[MAX_DB_STRING] = _T("");
        BOOL isDebug = FALSE, isEncrypt = FALSE;
        DWORD rcc, timeout = 3;
-   NXC_SESSION session;
        int ch;
 
    // Parse command line
@@ -148,31 +147,31 @@ int main(int argc, char *argv[])
 #define _HOST argv[optind]
 #endif
 
-       rcc = NXCConnect(isEncrypt ? NXCF_ENCRYPT : 0, _HOST, login,
-                             password, 0, NULL, NULL, &session,
-                    _T("nxsms/") NETXMS_VERSION_STRING, NULL);
+   NXCSession *session = new NXCSession();
+       rcc = session->connect(_HOST, login, password, isEncrypt ? NXCF_ENCRYPT : 0, _T("nxsms/") NETXMS_VERSION_STRING);
        if (rcc != RCC_SUCCESS)
        {
                _tprintf(_T("Unable to connect to server: %s\n"), NXCGetErrorText(rcc));
+      delete session;
                return 2;
        }
 
-       NXCSetCommandTimeout(session, timeout * 1000);
+       session->setCommandTimeout(timeout * 1000);
 
 #ifdef UNICODE
        WCHAR *rcpt = WideStringFromMBString(argv[optind + 1]);
        WCHAR *text = WideStringFromMBString(argv[optind + 2]);
-       rcc = NXCSendSMS(session, rcpt, text);
+       rcc = ((ServerController *)session->getController(CONTROLLER_SERVER))->sendSMS(rcpt, text);
        free(rcpt);
        free(text);
 #else
-       rcc = NXCSendSMS(session, argv[optind + 1], argv[optind + 2]);
+       rcc = ((ServerController *)session->getController(CONTROLLER_SERVER))->sendSMS(argv[optind + 1], argv[optind + 2]);
 #endif
        if (rcc != RCC_SUCCESS)
        {
                _tprintf(_T("Unable to send SMS: %s\n"), NXCGetErrorText(rcc));
        }
 
-   NXCDisconnect(session);
+   delete session;
        return (rcc == RCC_SUCCESS) ? 0 : 5;
 }
index 552bff4..2ba4b43 100644 (file)
@@ -25,7 +25,7 @@
 #define _nxsms_h_
 
 #include <nms_common.h>
-#include <nxclapi.h>
+#include <nxclient.h>
 
 #if HAVE_GETOPT_H
 #include <getopt.h>
index 6db0969..4087193 100644 (file)
@@ -5147,7 +5147,8 @@ public class NXCSession implements Session, ScriptLibraryManager, UserManager, S
       while(true)
       {
          final NXCPMessage response = waitForMessage(NXCPCodes.CMD_EVENT_DB_RECORD, msg.getMessageId());
-         if (response.isEndOfSequence()) break;
+         if (response.isEndOfSequence()) 
+            break;
          list.add(new EventTemplate(response));
       }
       return list;
index 58c7abb..9d49ea4 100644 (file)
@@ -826,13 +826,13 @@ void NXCPMessage::setFieldFromMBString(UINT32 fieldId, const char *value)
 /**
  * set binary field to an array of UINT32s
  */
-void NXCPMessage::setFieldFromInt32Array(UINT32 fieldId, UINT32 dwNumElements, const UINT32 *pdwData)
+void NXCPMessage::setFieldFromInt32Array(UINT32 fieldId, size_t numElements, const UINT32 *elements)
 {
-   UINT32 *pdwBuffer = (UINT32 *)set(fieldId, NXCP_DT_BINARY, pdwData, false, dwNumElements * sizeof(UINT32));
+   UINT32 *pdwBuffer = (UINT32 *)set(fieldId, NXCP_DT_BINARY, elements, false, numElements * sizeof(UINT32));
    if (pdwBuffer != NULL)
    {
       pdwBuffer++;   // First UINT32 is a length field
-      for(UINT32 i = 0; i < dwNumElements; i++)  // Convert UINT32s to network byte order
+      for(size_t i = 0; i < numElements; i++)  // Convert UINT32s to network byte order
          pdwBuffer[i] = htonl(pdwBuffer[i]);
    }
 }
index 571cacd..528f886 100644 (file)
@@ -42,6 +42,7 @@ MsgWaitQueue::MsgWaitQueue()
    m_size = 0;
    m_allocated = 0;
    m_elements = NULL;
+   m_sequence = 1;
    m_stopCondition = ConditionCreate(FALSE);
 #ifdef _WIN32
    InitializeCriticalSectionAndSpinCount(&m_mutex, 4000);
@@ -133,6 +134,7 @@ void MsgWaitQueue::put(NXCPMessage *pMsg)
    m_elements[pos].id = pMsg->getId();
    m_elements[pos].ttl = m_holdTime;
    m_elements[pos].msg = pMsg;
+   m_elements[pos].sequence = m_sequence++;
    m_size++;
 
 #ifdef _WIN32
@@ -171,6 +173,7 @@ void MsgWaitQueue::put(NXCP_MESSAGE *pMsg)
    m_elements[pos].id = pMsg->id;
    m_elements[pos].ttl = m_holdTime;
    m_elements[pos].msg = pMsg;
+   m_elements[pos].sequence = m_sequence++;
    m_size++;
 
 #ifdef _WIN32
@@ -199,6 +202,8 @@ void *MsgWaitQueue::waitForMessageInternal(UINT16 isBinary, UINT16 wCode, UINT32
 
    do
    {
+      UINT64 minSeq = _ULL(0xFFFFFFFFFFFFFFFF);
+      int index = -1;
       for(int i = 0; i < m_allocated; i++)
                {
          if ((m_elements[i].msg != NULL) && 
@@ -206,18 +211,27 @@ void *MsgWaitQueue::waitForMessageInternal(UINT16 isBinary, UINT16 wCode, UINT32
              (m_elements[i].code == wCode) &&
              (m_elements[i].isBinary == isBinary))
          {
-            void *msg = m_elements[i].msg;
-            m_elements[i].msg = NULL;
-            m_size--;
-#ifdef _WIN32
-            if (slot != -1)
-               m_waiters[slot] = 0;    // release waiter slot
-#endif
-            unlock();
-            return msg;
+            if (m_elements[i].sequence < minSeq)
+            {
+               minSeq = m_elements[i].sequence;
+               index = i;
+            }
          }
                }
 
+      if (index != -1)
+      {
+         void *msg = m_elements[index].msg;
+         m_elements[index].msg = NULL;
+         m_size--;
+#ifdef _WIN32
+         if (slot != -1)
+            m_waiters[slot] = 0;    // release waiter slot
+#endif
+         unlock();
+         return msg;
+      }
+
       INT64 startTime = GetCurrentTimeMs();
        
 #ifdef _WIN32
@@ -317,6 +331,14 @@ void MsgWaitQueue::housekeeperThread()
                m_elements[i].ttl -= TTL_CHECK_INTERVAL;
             }
                   }
+
+         // compact queue if possible
+         if ((m_allocated > ALLOCATION_STEP) && (m_size == 0))
+         {
+            m_allocated = ALLOCATION_STEP;
+            free(m_elements);
+            m_elements = (WAIT_QUEUE_ELEMENT *)calloc(m_allocated, sizeof(WAIT_QUEUE_ELEMENT));
+         }
       }
       unlock();
    }