Reworked Node flags. Instance, status and configuration polls functionality moved...
authorzev <zev@netxms.org>
Thu, 14 Sep 2017 17:14:33 +0000 (20:14 +0300)
committerzev <zev@netxms.org>
Thu, 21 Sep 2017 06:02:15 +0000 (09:02 +0300)
59 files changed:
include/nms_cscp.h
include/nxcldefs.h
sql/schema.in
sql/scripts.in
src/agent/subagents/dbquery/.cproject
src/agent/subagents/dbquery/.settings/org.eclipse.cdt.codan.core.prefs [new file with mode: 0644]
src/agent/subagents/filemgr/.cproject
src/agent/subagents/filemgr/.settings/org.eclipse.cdt.codan.core.prefs [new file with mode: 0644]
src/agent/subagents/java/.settings/language.settings.xml [deleted file]
src/client/java/netxms-client/src/main/java/org/netxms/client/NXCSession.java
src/client/java/netxms-client/src/main/java/org/netxms/client/ObjectMenuFilter.java
src/client/java/netxms-client/src/main/java/org/netxms/client/objects/AbstractNode.java
src/client/java/netxms-client/src/main/java/org/netxms/client/objects/Cluster.java
src/client/java/netxms-client/src/main/java/org/netxms/client/objects/DataCollectionTarget.java
src/client/java/netxms-client/src/main/java/org/netxms/client/objects/Node.java
src/client/java/netxms-client/src/main/java/org/netxms/client/objects/Sensor.java
src/java/client/netxms-client/src/main/java/org/netxms/client/objects/PollingTarget.java [new file with mode: 0644]
src/java/netxms-eclipse/NetworkMaps/src/org/netxms/ui/eclipse/networkmaps/views/VlanMap.java
src/java/netxms-eclipse/NetworkMaps/src/org/netxms/ui/eclipse/networkmaps/views/helpers/MapLabelProvider.java
src/java/netxms-eclipse/ObjectManager/plugin.xml
src/java/netxms-eclipse/ObjectManager/src/org/netxms/ui/eclipse/objectmanager/actions/AbstractNodePoll.java
src/java/netxms-eclipse/ObjectManager/src/org/netxms/ui/eclipse/objectmanager/actions/TopologyPoll.java
src/java/netxms-eclipse/ObjectManager/src/org/netxms/ui/eclipse/objectmanager/propertypages/ObjectPolling.java [moved from src/java/netxms-eclipse/ObjectManager/src/org/netxms/ui/eclipse/objectmanager/propertypages/NodePolling.java with 54% similarity]
src/java/netxms-eclipse/ObjectManager/src/org/netxms/ui/eclipse/objectmanager/views/NodePollerView.java
src/java/netxms-eclipse/ObjectManager/src/org/netxms/ui/eclipse/objectmanager/widgets/SensorCommon.java
src/java/netxms-eclipse/ObjectView/src/org/netxms/ui/eclipse/objectview/objecttabs/ComponentsTab.java
src/java/netxms-eclipse/ObjectView/src/org/netxms/ui/eclipse/objectview/objecttabs/elements/Capabilities.java
src/java/netxms-eclipse/ObjectView/src/org/netxms/ui/eclipse/objectview/objecttabs/elements/GeneralInfo.java
src/java/netxms-eclipse/Topology/src/org/netxms/ui/eclipse/topology/objecttabs/Ports.java
src/libnxjava/java/base/netxms-base/src/main/java/org/netxms/base/MacAddress.java
src/libnxjava/java/base/netxms-base/src/main/java/org/netxms/base/NXCPCodes.java
src/server/core/accesspoint.cpp
src/server/core/cdp.cpp
src/server/core/cluster.cpp
src/server/core/console.cpp
src/server/core/container.cpp
src/server/core/correlate.cpp
src/server/core/dashboard.cpp
src/server/core/dctarget.cpp
src/server/core/interface.cpp
src/server/core/lldp.cpp
src/server/core/lln.cpp
src/server/core/ndp.cpp
src/server/core/netmap.cpp
src/server/core/netobj.cpp
src/server/core/netsrv.cpp
src/server/core/node.cpp
src/server/core/np.cpp
src/server/core/nxsl_classes.cpp
src/server/core/objects.cpp
src/server/core/package.cpp
src/server/core/poll.cpp
src/server/core/sensor.cpp
src/server/core/session.cpp
src/server/core/stp.cpp
src/server/core/template.cpp
src/server/include/nms_core.h
src/server/include/nms_objects.h
src/server/tools/nxdbmgr/upgrade.cpp

index f69e6d9..2bc72c0 100644 (file)
@@ -1204,6 +1204,8 @@ typedef struct
 #define VID_LORA_APP_S_KEY          ((UINT32)598)
 #define VID_LORA_NWK_S_KWY          ((UINT32)599)
 #define VID_DCI_NAME                ((UINT32)600)
+#define VID_STATE_FLAGS             ((UINT32)601)
+#define VID_CAPABILITIES            ((UINT32)602)
 
 // Base variabe for single threshold in message
 #define VID_THRESHOLD_BASE          ((UINT32)0x00800000)
index ccdd558..223f29b 100644 (file)
 /**
  * Node capabilities
  */
-#define NF_IS_SNMP                0x00000001
-#define NF_IS_NATIVE_AGENT        0x00000002
-#define NF_IS_BRIDGE              0x00000004
-#define NF_IS_ROUTER              0x00000008
-#define NF_IS_LOCAL_MGMT          0x00000010
-#define NF_IS_PRINTER             0x00000020
-#define NF_IS_OSPF                0x00000040
-#define NF_IS_CPSNMP              0x00000100  /* CheckPoint SNMP agent on port 260 */
-#define NF_IS_CDP                 0x00000200
-#define NF_IS_NDP                 0x00000400  /* Supports Nortel (Synoptics/Bay Networks) topology discovery */
-#define NF_IS_SONMP               0x00000400  /* SONMP is an old name for NDP */
-#define NF_IS_LLDP                0x00000800 /* Supports Link Layer Discovery Protocol */
-#define NF_IS_VRRP                0x00001000  /* VRRP support */
-#define NF_HAS_VLANS              0x00002000  /* VLAN information available */
-#define NF_IS_8021X               0x00004000  /* 802.1x support enabled on node */
-#define NF_IS_STP                 0x00008000  /* Spanning Tree (IEEE 802.1d) enabled on node */
-#define NF_HAS_ENTITY_MIB         0x00010000  /* Supports ENTITY-MIB */
-#define NF_HAS_IFXTABLE           0x00020000  /* Supports ifXTable */
-#define NF_HAS_AGENT_IFXCOUNTERS  0x00040000  /* Agent supports 64-bit interface counters */
-#define NF_HAS_WINPDH             0x00080000  /* Node supports Windows PDH parameters */
-#define NF_IS_WIFI_CONTROLLER     0x00100000  /* Node is wireless network controller */
-#define NF_IS_SMCLP               0x00200000  /* Node supports SMCLP protocol */
+#define NC_IS_SNMP                0x00000001
+#define NC_IS_NATIVE_AGENT        0x00000002
+#define NC_IS_BRIDGE              0x00000004
+#define NC_IS_ROUTER              0x00000008
+#define NC_IS_LOCAL_MGMT          0x00000010
+#define NC_IS_PRINTER             0x00000020
+#define NC_IS_OSPF                0x00000040
+#define NC_IS_CPSNMP              0x00000080  /* CheckPoint SNMP agent on port 260 */
+#define NC_IS_CDP                 0x00000100
+#define NC_IS_NDP                 0x00000200  /* Supports Nortel (Synoptics/Bay Networks) topology discovery */ /* SONMP is an old name for NDP */
+#define NC_IS_LLDP                0x00000400 /* Supports Link Layer Discovery Protocol */
+#define NC_IS_VRRP                0x00000800  /* VRRP support */
+#define NC_HAS_VLANS              0x00001000  /* VLAN information available */
+#define NC_IS_8021X               0x00002000  /* 802.1x support enabled on node */
+#define NC_IS_STP                 0x00004000  /* Spanning Tree (IEEE 802.1d) enabled on node */
+#define NC_HAS_ENTITY_MIB         0x00008000  /* Supports ENTITY-MIB */
+#define NC_HAS_IFXTABLE           0x00010000  /* Supports ifXTable */
+#define NC_HAS_AGENT_IFXCOUNTERS  0x00020000  /* Agent supports 64-bit interface counters */
+#define NC_HAS_WINPDH             0x00040000  /* Node supports Windows PDH parameters */
+#define NC_IS_WIFI_CONTROLLER     0x00080000  /* Node is wireless network controller */
+#define NC_IS_SMCLP               0x00100000  /* Node supports SMCLP protocol */
+
+/**
+ * Flag separator
+ */
+#define DCF_COLLECTION_FLAGS 0x0000FFFF
 
 /**
  * Node flags
  */
-#define NF_SYSTEM_FLAGS           0x003FFF7F
-#define NF_USER_FLAGS             0xFFC00080
-
-#define NF_REMOTE_AGENT           0x00000080
-#define NF_DISABLE_DISCOVERY_POLL 0x00400000
-#define NF_DISABLE_TOPOLOGY_POLL  0x00800000
-#define NF_DISABLE_SNMP           0x01000000
-#define NF_DISABLE_NXCP           0x02000000
-#define NF_DISABLE_ICMP           0x04000000
-#define NF_FORCE_ENCRYPTION       0x08000000
-#define NF_DISABLE_STATUS_POLL    0x10000000
-#define NF_DISABLE_CONF_POLL      0x20000000
-#define NF_DISABLE_ROUTE_POLL     0x40000000
-#define NF_DISABLE_DATA_COLLECT   0x80000000
+#define NF_REMOTE_AGENT           0x00010000
+#define NF_DISABLE_DISCOVERY_POLL 0x00020000
+#define NF_DISABLE_TOPOLOGY_POLL  0x00040000
+#define NF_DISABLE_SNMP           0x00080000
+#define NF_DISABLE_NXCP           0x00100000
+#define NF_DISABLE_ICMP           0x00200000
+#define NF_FORCE_ENCRYPTION       0x00400000
+#define NF_DISABLE_ROUTE_POLL     0x00800000
+
+/**
+ * Data Collection flags first half of int
+ */
+#define DCF_DISABLE_STATUS_POLL    0x00000001
+#define DCF_DISABLE_CONF_POLL      0x00000002
+#define DCF_DISABLE_DATA_COLLECT   0x00000004
+
+
+/**
+ * Data Collection Object runtime (dynamic) flags first half of int
+ */
+#define DCDF_QUEUED_FOR_STATUS_POLL        0x0001
+#define DCDF_QUEUED_FOR_CONFIGURATION_POLL 0x0002
+#define DCDF_QUEUED_FOR_INSTANCE_POLL      0x0004
+#define DCDF_DELETE_IN_PROGRESS            0x0008
+#define DCDF_FORCE_STATUS_POLL             0x0010
+#define DCDF_FORCE_CONFIGURATION_POLL      0x0020
+#define DCDF_CONFIGURATION_POLL_PASSED     0x0040
+
+/**
+ * Node runtime (dynamic) flags
+ */
+#define NDF_QUEUED_FOR_TOPOLOGY_POLL   0x00010000
+#define NDF_QUEUED_FOR_DISCOVERY_POLL  0x00020000
+#define NDF_QUEUED_FOR_ROUTE_POLL      0x00040000
+#define NDF_RECHECK_CAPABILITIES       0x00100000
+
+/**
+ * Cluster status flags
+ */
+#define CLSF_DOWN                      0x000001
+
+/**
+ * Node status flags
+ */
+#define NSF_UNREACHABLE                0x000001
+#define NSF_AGENT_UNREACHABLE          0x000002
+#define NSF_SNMP_UNREACHABLE           0x000004
+#define NSF_CPSNMP_UNREACHABLE         0x000020
+#define NSF_NETWORK_PATH_PROBLEM       0x000100
+#define NSF_CACHE_MODE_NOT_SUPPORTED   0x000200
+
+/**
+ * Sensor status flags
+ */
+#define SSF_PROVISIONED                0x000001
+#define SSF_REGISTERED                 0x000002
+#define SSF_ACTIVE                     0x000004
+#define SSF_CONF_UPDATE_PENDING        0x000008
+#define SSF_AGENT_UNREACHABLE          0x000010
 
 /**
  * Template flags
index 95973a1..5268c21 100644 (file)
@@ -151,6 +151,8 @@ CREATE TABLE object_properties
   object_id integer not null,
   guid varchar(36) not null,
   name varchar(63) not null,
+  flags integer not null,
+  state integer not null,
   status integer not null,
   is_deleted integer not null,
   is_system integer not null,
@@ -267,7 +269,6 @@ CREATE TABLE chassis
 (
   id integer not null,
   controller_id integer not null,
-  flags integer not null,
   rack_id integer not null,
   rack_image varchar(36) null,
   rack_position integer not null,
@@ -284,8 +285,6 @@ CREATE TABLE nodes
   primary_name varchar(255) null,
   primary_ip varchar(48) not null,
   tunnel_id varchar(36) null,
-  node_flags integer not null,
-  runtime_flags integer not null,
   snmp_version integer not null,
   snmp_port integer not null,
   community varchar(127) null,
@@ -332,6 +331,7 @@ CREATE TABLE nodes
   port_rows integer null,
   port_numbering_scheme integer null,
   agent_comp_mode char(1) not null, // compression mode for agent
+  capabilities integer null,
   PRIMARY KEY(id)
 ) TABLE_TYPE;
 
@@ -405,7 +405,6 @@ CREATE TABLE interfaces
   id integer not null,
   node_id integer not null,
   parent_iface integer not null,
-  flags integer not null,
   if_type integer not null,
   if_index integer not null,
   mtu integer not null,
@@ -488,7 +487,6 @@ CREATE TABLE object_containers
 (
   id integer not null,
   object_class integer not null,
-  flags integer not null,
   auto_bind_filter SQL_TEXT null,
   PRIMARY KEY(id)
 ) TABLE_TYPE;
@@ -529,7 +527,6 @@ CREATE TABLE templates
 (
   id integer not null,
   version integer not null,
-  flags integer not null,
   apply_filter SQL_TEXT null,
   PRIMARY KEY(id)
 ) TABLE_TYPE;
@@ -1363,7 +1360,6 @@ CREATE TABLE network_maps
   bg_latitude varchar(20) null,
   bg_longitude varchar(20) null,
   bg_zoom integer null,
-  flags integer not null,
   bg_color integer not null,
   link_color integer not null,
   link_routing integer not null,
@@ -1734,7 +1730,6 @@ CREATE TABLE sensors
 (
    id integer not null,
    proxy_node integer not null,
-   flags integer not null,
    mac_address varchar(16) null,
    device_class integer not null,
    vendor varchar(128) null,
@@ -1750,6 +1745,5 @@ CREATE TABLE sensors
    signal_strenght integer not null,
    signal_noise integer not null,
    frequency integer not null,
-   runtime_flags integer null,
    PRIMARY KEY(id)
 ) TABLE_TYPE;
index b757b79..2f9a8e4 100644 (file)
@@ -15,11 +15,11 @@ INSERT INTO script_library (guid,script_id,script_name,script_code)
        VALUES ('efe50915-47b2-43d8-b4f4-2c09a44970c3',4,'DCI::SampleTransform','sub dci_transform()' CONCAT CRLF CONCAT '{' CONCAT CRLF CONCAT '   return $1 + 1;' CONCAT CRLF CONCAT '}' CONCAT CRLF);
 
 INSERT INTO script_library (guid,script_id,script_name,script_code)
-       VALUES ('7837580c-4054-40f2-981f-7185797fe7d7',11,'Hook::StatusPoll','/* Available global variables:' CONCAT CRLF CONCAT ' *  $node - current node, object of ''Node'' type' CONCAT CRLF CONCAT ' *' CONCAT CRLF CONCAT ' * Expected return value:' CONCAT CRLF CONCAT ' *  none - returned value is ignored' CONCAT CRLF CONCAT ' */' CONCAT CRLF);
+       VALUES ('7837580c-4054-40f2-981f-7185797fe7d7',11,'Hook::StatusPoll','/* Available global variables:' CONCAT CRLF CONCAT ' *  $object - current object, one of ''NetObj'' subclasses' CONCAT CRLF CONCAT ' *  $node - current object if it is ''Node'' class' CONCAT CRLF CONCAT ' *' CONCAT CRLF CONCAT ' * Expected return value:' CONCAT CRLF CONCAT ' *  none - returned value is ignored' CONCAT CRLF CONCAT ' */' CONCAT CRLF);
 INSERT INTO script_library (guid,script_id,script_name,script_code)
-       VALUES ('f7d1bc7e-4046-4ee4-adb2-718f7361984d',12,'Hook::ConfigurationPoll','/* Available global variables:' CONCAT CRLF CONCAT ' *  $node - current node, object of ''Node'' type' CONCAT CRLF CONCAT ' *' CONCAT CRLF CONCAT ' * Expected return value:' CONCAT CRLF CONCAT ' *  none - returned value is ignored' CONCAT CRLF CONCAT ' */' CONCAT CRLF);
+       VALUES ('f7d1bc7e-4046-4ee4-adb2-718f7361984d',12,'Hook::ConfigurationPoll','/* Available global variables:' CONCAT CRLF CONCAT ' *  $object - current object, one of ''NetObj'' subclasses' CONCAT CRLF CONCAT ' *  $node - current object if it is ''Node'' class' CONCAT CRLF CONCAT ' *' CONCAT CRLF CONCAT ' * Expected return value:' CONCAT CRLF CONCAT ' *  none - returned value is ignored' CONCAT CRLF CONCAT ' */' CONCAT CRLF);
 INSERT INTO script_library (guid,script_id,script_name,script_code)
-       VALUES ('048fcf32-765b-4702-9c70-f012f62d5a90',13,'Hook::InstancePoll','/* Available global variables:' CONCAT CRLF CONCAT ' *  $node - current node, object of ''Node'' type' CONCAT CRLF CONCAT ' *' CONCAT CRLF CONCAT ' * Expected return value:' CONCAT CRLF CONCAT ' *  none - returned value is ignored' CONCAT CRLF CONCAT ' */' CONCAT CRLF);
+       VALUES ('048fcf32-765b-4702-9c70-f012f62d5a90',13,'Hook::InstancePoll','/* Available global variables:' CONCAT CRLF CONCAT ' *  $object - current object, one of ''NetObj'' subclasses' CONCAT CRLF CONCAT ' *  $node - current object if it is ''Node'' class' CONCAT CRLF CONCAT ' *' CONCAT CRLF CONCAT ' * Expected return value:' CONCAT CRLF CONCAT ' *  none - returned value is ignored' CONCAT CRLF CONCAT ' */' CONCAT CRLF);
 INSERT INTO script_library (guid,script_id,script_name,script_code)
        VALUES ('d515c10f-a5c9-4f41-afcd-9ddc8845f288',14,'Hook::TopologyPoll','/* Available global variables:' CONCAT CRLF CONCAT ' *  $node - current node, object of ''Node'' type' CONCAT CRLF CONCAT ' *' CONCAT CRLF CONCAT ' * Expected return value:' CONCAT CRLF CONCAT ' *  none - returned value is ignored' CONCAT CRLF CONCAT ' */' CONCAT CRLF);
 INSERT INTO script_library (guid,script_id,script_name,script_code)
index 39c4ca4..f0904cb 100644 (file)
@@ -81,4 +81,5 @@
                        <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
                </scannerConfigBuildInfo>
        </storageModule>
+       <storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
 </cproject>
diff --git a/src/agent/subagents/dbquery/.settings/org.eclipse.cdt.codan.core.prefs b/src/agent/subagents/dbquery/.settings/org.eclipse.cdt.codan.core.prefs
new file mode 100644 (file)
index 0000000..77386c2
--- /dev/null
@@ -0,0 +1,67 @@
+eclipse.preferences.version=1
+org.eclipse.cdt.codan.checkers.errnoreturn=Warning
+org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
+org.eclipse.cdt.codan.checkers.errreturnvalue=Error
+org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.checkers.noreturn=Error
+org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
+org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
+org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
+org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
+org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false}
+org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
+org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},unknown\=>false,exceptions\=>()}
+org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
+org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning
+org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},skip\=>true}
+org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
+org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
+org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
+org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
+org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
+org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
+org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
+org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
+org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>()}
+org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},paramNot\=>false}
+org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},else\=>false,afterelse\=>false}
+org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
+org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
+org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>("@(\#)","$Id")}
+org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
index 42d186c..e500b21 100644 (file)
@@ -18,7 +18,7 @@
                                        <folderInfo id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1891696841.1983102993" name="/" resourcePath="">
                                                <toolChain id="org.eclipse.linuxtools.cdt.autotools.core.toolChain.2057887868" name="GNU Autotools Toolchain" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolChain">
                                                        <targetPlatform id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform.655061558" isAbstract="false" name="GNU Autotools Target Platform" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.targetPlatform"/>
-                                                       <builder id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder.935940012" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Autotools Makefile Generator" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder"/>
+                                                       <builder id="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder.935940012" keepEnvironmentInBuildfile="false" managedBuildOn="false" superClass="org.eclipse.linuxtools.cdt.autotools.core.toolchain.builder"/>
                                                        <tool id="org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure.2033925796" name="configure" superClass="org.eclipse.linuxtools.cdt.autotools.core.gnu.toolchain.tool.configure">
                                                                <option id="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name.1690683612" name="Name" superClass="org.eclipse.linuxtools.cdt.autotools.core.option.configure.name" value="org.eclipse.linuxtools.cdt.autotools.core.toolChain.1891696841" valueType="string"/>
                                                        </tool>
diff --git a/src/agent/subagents/filemgr/.settings/org.eclipse.cdt.codan.core.prefs b/src/agent/subagents/filemgr/.settings/org.eclipse.cdt.codan.core.prefs
new file mode 100644 (file)
index 0000000..77386c2
--- /dev/null
@@ -0,0 +1,67 @@
+eclipse.preferences.version=1
+org.eclipse.cdt.codan.checkers.errnoreturn=Warning
+org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
+org.eclipse.cdt.codan.checkers.errreturnvalue=Error
+org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.checkers.noreturn=Error
+org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
+org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
+org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
+org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
+org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false}
+org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
+org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},unknown\=>false,exceptions\=>()}
+org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
+org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning
+org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},skip\=>true}
+org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
+org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
+org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
+org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
+org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
+org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
+org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
+org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
+org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>()}
+org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},paramNot\=>false}
+org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},else\=>false,afterelse\=>false}
+org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
+org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
+org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
+org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
+org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>("@(\#)","$Id")}
+org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error
+org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
diff --git a/src/agent/subagents/java/.settings/language.settings.xml b/src/agent/subagents/java/.settings/language.settings.xml
deleted file mode 100644 (file)
index db8122e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<project>
-       <configuration id="cdt.managedbuild.toolchain.gnu.base.2026808676" name="Default">
-               <extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
-                       <provider class="org.eclipse.cdt.core.language.settings.providers.LanguageSettingsGenericProvider" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider" name="CDT User Setting Entries" prefer-non-shared="true"/>
-                       <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
-                       <provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
-                       <provider-reference id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" ref="shared-provider"/>
-                       <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
-               </extension>
-       </configuration>
-</project>
index 55de860..f0abb4a 100644 (file)
@@ -5079,7 +5079,7 @@ public class NXCSession
       
       if (data.isFieldSet(NXCObjectModificationData.MAC_ADDRESS))
       {
-         msg.setField(NXCPCodes.VID_MAC_ADDR, data.getMacAddress().getValue());
+         msg.setField(NXCPCodes.VID_MAC_ADDR, data.getMacAddress());
       }
       
       if (data.isFieldSet(NXCObjectModificationData.DEVICE_CLASS))
index f173bdc..50bd6f6 100644 (file)
@@ -100,11 +100,11 @@ public class ObjectMenuFilter
    public boolean isApplicableForNode(AbstractNode node)
    {
       if (((flags & REQUIRES_SNMP) != 0) &&
-          ((node.getFlags() & AbstractNode.NF_IS_SNMP) == 0))
+          ((node.getCapabilities() & AbstractNode.NC_IS_SNMP) == 0))
          return false;  // Node does not support SNMP
       
       if (((flags & REQUIRES_AGENT) != 0) &&
-             ((node.getFlags() & AbstractNode.NF_IS_NATIVE_AGENT) == 0))
+             ((node.getCapabilities() & AbstractNode.NC_IS_NATIVE_AGENT) == 0))
             return false;  // Node does not have NetXMS agent
       
       if ((flags & REQUIRES_OID_MATCH) != 0)
index 121ec76..0fdb88a 100644 (file)
@@ -33,7 +33,7 @@ import org.netxms.client.constants.NodeType;
 /**
  * Abstract base class for node objects.
  */
-public abstract class AbstractNode extends DataCollectionTarget implements RackElement, ZoneMember
+public abstract class AbstractNode extends DataCollectionTarget implements RackElement, ZoneMember, PollingTarget
 {
        // SNMP versions
        public static final int SNMP_VERSION_1 = 0;
@@ -46,46 +46,44 @@ public abstract class AbstractNode extends DataCollectionTarget implements RackE
        public static final int AGENT_AUTH_MD5 = 2;
        public static final int AGENT_AUTH_SHA1 = 3;
        
-       // Node flags
-       public static final int NF_IS_SNMP                = 0x00000001;
-       public static final int NF_IS_NATIVE_AGENT        = 0x00000002;
-       public static final int NF_IS_BRIDGE              = 0x00000004;
-       public static final int NF_IS_ROUTER              = 0x00000008;
-       public static final int NF_IS_LOCAL_MGMT          = 0x00000010;
-       public static final int NF_IS_PRINTER             = 0x00000020;
-       public static final int NF_IS_OSPF                = 0x00000040;
-   public static final int NF_REMOTE_AGENT           = 0x00000080;
-       public static final int NF_IS_CPSNMP              = 0x00000100;
-       public static final int NF_IS_CDP                 = 0x00000200;
-       public static final int NF_IS_SONMP               = 0x00000400;
-       public static final int NF_IS_LLDP                = 0x00000800;
-       public static final int NF_IS_VRRP                = 0x00001000;
-       public static final int NF_HAS_VLANS              = 0x00002000;
-       public static final int NF_IS_8021X               = 0x00004000;
-       public static final int NF_IS_STP                 = 0x00008000;
-       public static final int NF_HAS_ENTITY_MIB         = 0x00010000;
-       public static final int NF_HAS_IFXTABLE           = 0x00020000;
-       public static final int NF_HAS_AGENT_IFXCOUNTERS  = 0x00040000;
-       public static final int NF_HAS_WINPDH             = 0x00080000;
-       public static final int NF_IS_WIFI_CONTROLLER     = 0x00100000;
-       public static final int NF_IS_SMCLP               = 0x00200000;
-       public static final int NF_DISABLE_DISCOVERY_POLL = 0x00400000;
-       public static final int NF_DISABLE_TOPOLOGY_POLL  = 0x00800000;
-       public static final int NF_DISABLE_SNMP           = 0x01000000;
-       public static final int NF_DISABLE_NXCP           = 0x02000000;
-       public static final int NF_DISABLE_ICMP           = 0x04000000;
-       public static final int NF_FORCE_ENCRYPTION       = 0x08000000;
-       public static final int NF_DISABLE_STATUS_POLL    = 0x10000000;
-       public static final int NF_DISABLE_CONF_POLL      = 0x20000000;
-       public static final int NF_DISABLE_ROUTE_POLL     = 0x40000000;
-       public static final int NF_DISABLE_DATA_COLLECT   = 0x80000000;
+       // Node capabilities
+       public static final int NC_IS_SNMP                = 0x00000001;
+       public static final int NC_IS_NATIVE_AGENT        = 0x00000002;
+       public static final int NC_IS_BRIDGE              = 0x00000004;
+       public static final int NC_IS_ROUTER              = 0x00000008;
+       public static final int NC_IS_LOCAL_MGMT          = 0x00000010;
+       public static final int NC_IS_PRINTER             = 0x00000020;
+       public static final int NC_IS_OSPF                = 0x00000040;
+       public static final int NC_IS_CPSNMP              = 0x00000080;
+       public static final int NC_IS_CDP                 = 0x00000100;
+       public static final int NC_IS_NDP                 = 0x00000200;
+       public static final int NC_IS_LLDP                = 0x00000400;
+       public static final int NC_IS_VRRP                = 0x00000800;
+       public static final int NC_HAS_VLANS              = 0x00001000;
+       public static final int NC_IS_8021X               = 0x00002000;
+       public static final int NC_IS_STP                 = 0x00004000;
+       public static final int NC_HAS_ENTITY_MIB         = 0x00008000;
+       public static final int NC_HAS_IFXTABLE           = 0x00010000;
+       public static final int NC_HAS_AGENT_IFXCOUNTERS  = 0x00020000;
+       public static final int NC_HAS_WINPDH             = 0x00040000;
+       public static final int NC_IS_WIFI_CONTROLLER     = 0x00080000;
+       public static final int NC_IS_SMCLP               = 0x00100000;
+
+       //Node flags
+   public static final int NF_REMOTE_AGENT           = 0x00010000;
+       public static final int NF_DISABLE_DISCOVERY_POLL = 0x00020000;
+       public static final int NF_DISABLE_TOPOLOGY_POLL  = 0x00040000;
+       public static final int NF_DISABLE_SNMP           = 0x00080000;
+       public static final int NF_DISABLE_NXCP           = 0x00100000;
+       public static final int NF_DISABLE_ICMP           = 0x00200000;
+       public static final int NF_FORCE_ENCRYPTION       = 0x00400000;
+   public static final int NF_DISABLE_ROUTE_POLL     = 0x00800000;
        
        // Node runtime flags
-       public static final int NDF_UNREACHABLE        = 0x000000004;
-       public static final int NDF_AGENT_UNREACHABLE  = 0x000000008;
-       public static final int NDF_SNMP_UNREACHABLE   = 0x000000010;
-       public static final int NDF_CPSNMP_UNREACHABLE = 0x000000200;
-       public static final int NDF_POLLING_DISABLED   = 0x000000800;
+       public static final int NSF_UNREACHABLE        = 0x000000001;
+       public static final int NSF_AGENT_UNREACHABLE  = 0x000000002;
+       public static final int NSF_SNMP_UNREACHABLE   = 0x000000004;
+       public static final int NSF_CPSNMP_UNREACHABLE = 0x000000008;
        
        public static final int IFXTABLE_DEFAULT = 0;
        public static final int IFXTABLE_ENABLED = 1;
@@ -94,7 +92,8 @@ public abstract class AbstractNode extends DataCollectionTarget implements RackE
        protected InetAddressEx primaryIP;
        protected String primaryName;
        protected int flags;
-       protected int runtimeFlags;
+       protected int stateFlags;
+       protected int capabilities;
        protected NodeType nodeType;
        protected String nodeSubType;
        protected int requredPollCount;
@@ -165,7 +164,8 @@ public abstract class AbstractNode extends DataCollectionTarget implements RackE
                primaryIP = msg.getFieldAsInetAddressEx(NXCPCodes.VID_IP_ADDRESS);
                primaryName = msg.getFieldAsString(NXCPCodes.VID_PRIMARY_NAME);
                flags = msg.getFieldAsInt32(NXCPCodes.VID_FLAGS);
-               runtimeFlags = msg.getFieldAsInt32(NXCPCodes.VID_RUNTIME_FLAGS);
+               stateFlags = msg.getFieldAsInt32(NXCPCodes.VID_STATE_FLAGS);
+               capabilities = msg.getFieldAsInt32(NXCPCodes.VID_CAPABILITIES);
                nodeType = NodeType.getByValue(msg.getFieldAsInt16(NXCPCodes.VID_NODE_TYPE));
                nodeSubType = msg.getFieldAsString(NXCPCodes.VID_NODE_SUBTYPE);
                requredPollCount = msg.getFieldAsInt32(NXCPCodes.VID_REQUIRED_POLLS);
@@ -227,12 +227,20 @@ public abstract class AbstractNode extends DataCollectionTarget implements RackE
                return flags;
        }
 
+   /**
+    * @return Flags
+    */
+   public int getCapabilities()
+   {
+      return capabilities;
+   }
+
        /**
         * @return Runtime flags
         */
-       public int getRuntimeFlags()
+       public int getStateFlags()
        {
-               return runtimeFlags;
+               return stateFlags;
        }
 
        /**
@@ -427,7 +435,7 @@ public abstract class AbstractNode extends DataCollectionTarget implements RackE
         */
        public boolean hasAgent()
        {
-               return (flags & NF_IS_NATIVE_AGENT) != 0;
+               return (capabilities & NC_IS_NATIVE_AGENT) != 0;
        }
 
        /**
@@ -436,7 +444,7 @@ public abstract class AbstractNode extends DataCollectionTarget implements RackE
         */
        public boolean hasSnmpAgent()
        {
-               return (flags & NF_IS_SNMP) != 0;
+               return (capabilities & NC_IS_SNMP) != 0;
        }
 
        /**
@@ -445,7 +453,7 @@ public abstract class AbstractNode extends DataCollectionTarget implements RackE
         */
        public boolean isManagementServer()
        {
-               return (flags & NF_IS_LOCAL_MGMT) != 0;
+               return (flags & NC_IS_LOCAL_MGMT) != 0;
        }
 
        /**
@@ -454,7 +462,7 @@ public abstract class AbstractNode extends DataCollectionTarget implements RackE
         */
        public boolean isVrrpSupported()
        {
-               return (flags & NF_IS_VRRP) != 0;
+               return (capabilities & NC_IS_VRRP) != 0;
        }
 
        /**
@@ -463,7 +471,7 @@ public abstract class AbstractNode extends DataCollectionTarget implements RackE
         */
        public boolean is8021xSupported()
        {
-               return (flags & NF_IS_8021X) != 0;
+               return (capabilities & NC_IS_8021X) != 0;
        }
 
        /**
@@ -472,7 +480,7 @@ public abstract class AbstractNode extends DataCollectionTarget implements RackE
         */
        public boolean isSpanningTreeSupported()
        {
-               return (flags & NF_IS_STP) != 0;
+               return (capabilities & NC_IS_STP) != 0;
        }
 
        /**
@@ -481,7 +489,7 @@ public abstract class AbstractNode extends DataCollectionTarget implements RackE
         */
        public boolean isEntityMibSupported()
        {
-               return (flags & NF_HAS_ENTITY_MIB) != 0;
+               return (capabilities & NC_HAS_ENTITY_MIB) != 0;
        }
 
        /**
@@ -490,7 +498,7 @@ public abstract class AbstractNode extends DataCollectionTarget implements RackE
         */
        public boolean isIfXTableSupported()
        {
-               return (flags & NF_HAS_IFXTABLE) != 0;
+               return (capabilities & NC_HAS_IFXTABLE) != 0;
        }
 
        /**
@@ -499,7 +507,7 @@ public abstract class AbstractNode extends DataCollectionTarget implements RackE
         */
        public boolean isAgentIfXCountersSupported()
        {
-               return (flags & NF_HAS_AGENT_IFXCOUNTERS) != 0;
+               return (capabilities & NC_HAS_AGENT_IFXCOUNTERS) != 0;
        }
 
        /**
@@ -508,7 +516,7 @@ public abstract class AbstractNode extends DataCollectionTarget implements RackE
         */
        public boolean isWirelessController()
        {
-               return (flags & NF_IS_WIFI_CONTROLLER) != 0;
+               return (capabilities & NC_IS_WIFI_CONTROLLER) != 0;
        }
 
        /**
index 0313274..9d5d01d 100644 (file)
@@ -24,16 +24,18 @@ import org.netxms.base.InetAddressEx;
 import org.netxms.base.NXCPCodes;
 import org.netxms.base.NXCPMessage;
 import org.netxms.client.NXCSession;
+import org.netxms.client.constants.AgentCacheMode;
 
 /**
  * Cluster object
  */
-public class Cluster extends DataCollectionTarget implements ZoneMember
+public class Cluster extends DataCollectionTarget implements ZoneMember, PollingTarget
 {
        private int clusterType;
        private List<InetAddressEx> syncNetworks = new ArrayList<InetAddressEx>(1);
        private List<ClusterResource> resources = new ArrayList<ClusterResource>();
        private long zoneId;
+       private int flags;
        
        /**
         * @param msg
@@ -43,6 +45,7 @@ public class Cluster extends DataCollectionTarget implements ZoneMember
        {
                super(msg, session);
                
+      flags = msg.getFieldAsInt32(NXCPCodes.VID_FLAGS);
                clusterType = msg.getFieldAsInt32(NXCPCodes.VID_CLUSTER_TYPE);
                zoneId = msg.getFieldAsInt64(NXCPCodes.VID_ZONE_UIN);
                
@@ -130,4 +133,46 @@ public class Cluster extends DataCollectionTarget implements ZoneMember
       Zone zone = session.findZone(zoneId);
       return (zone != null) ? zone.getObjectName() : Long.toString(zoneId);
    }
+
+   @Override
+   public int getIfXTablePolicy()
+   {
+      return 0;
+   }
+
+   @Override
+   public AgentCacheMode getAgentCacheMode()
+   {
+      return null;
+   }
+
+   @Override
+   public int getFlags()
+   {
+      return flags;
+   }
+
+   @Override
+   public long getPollerNodeId()
+   {
+      return 0;
+   }
+
+   @Override
+   public boolean containAgent()
+   {
+      return false;
+   }
+
+   @Override
+   public boolean containInterfaces()
+   {
+      return false;
+   }
+
+   @Override
+   public boolean containPollerNode()
+   {
+      return false;
+   }
 }
index 4a8e29b..d322cf8 100644 (file)
@@ -29,7 +29,11 @@ import org.netxms.client.datacollection.DciValue;
  * Base class for all data collection targets
  */
 public class DataCollectionTarget extends GenericObject
-{
+{   
+   public static final int DCF_DISABLE_STATUS_POLL    = 0x00000001;
+   public static final int DCF_DISABLE_CONF_POLL      = 0x00000002;
+   public static final int DCF_DISABLE_DATA_COLLECT   = 0x00000004;
+   
    protected List<DciValue> overviewDciData;
    protected List<DciValue> tooltipDciData;
 
index a855584..f91c27a 100644 (file)
@@ -74,4 +74,22 @@ public class Node extends AbstractNode
    {
       return true;
    }
+
+   @Override
+   public boolean containAgent()
+   {
+      return true;
+   }
+
+   @Override
+   public boolean containInterfaces()
+   {
+      return true;
+   }
+
+   @Override
+   public boolean containPollerNode()
+   {
+      return true;
+   }
 }
index 2bde6ea..1341463 100644 (file)
@@ -25,6 +25,7 @@ import org.netxms.base.MacAddress;
 import org.netxms.base.NXCPCodes;
 import org.netxms.base.NXCPMessage;
 import org.netxms.client.NXCSession;
+import org.netxms.client.constants.AgentCacheMode;
 import org.netxms.client.sensor.configs.DlmsConfig;
 import org.netxms.client.sensor.configs.LoraWanConfig;
 import org.netxms.client.sensor.configs.LoraWanRegConfig;
@@ -34,7 +35,7 @@ import org.netxms.client.sensor.configs.SensorRegistrationConfig;
 /**
  * Mobile device object
  */
-public class Sensor extends DataCollectionTarget
+public class Sensor extends DataCollectionTarget implements PollingTarget
 {
    /**
     * Sensor flags
@@ -205,8 +206,7 @@ public class Sensor extends DataCollectionTarget
             catch(Exception e)
             {
                config = new DlmsConfig();
-               System.out.println(xml);
-               Logger.debug("Sensor.Sensor", "Cannot parse LoraWanConfig XML", e);
+               //Logger.debug("Sensor.Sensor", "Cannot parse DlmsConfig XML", e);
             }
             break;
          default:
@@ -349,4 +349,39 @@ public class Sensor extends DataCollectionTarget
       return config;
    }
 
+   @Override
+   public int getIfXTablePolicy()
+   {
+      return 0;
+   }
+
+   @Override
+   public AgentCacheMode getAgentCacheMode()
+   {
+      return null;
+   }
+
+   @Override
+   public long getPollerNodeId()
+   {
+      return 0;
+   }
+
+   @Override
+   public boolean containAgent()
+   {
+      return false;
+   }
+
+   @Override
+   public boolean containInterfaces()
+   {
+      return false;
+   }
+
+   @Override
+   public boolean containPollerNode()
+   {
+      return false;
+   }
 }
diff --git a/src/java/client/netxms-client/src/main/java/org/netxms/client/objects/PollingTarget.java b/src/java/client/netxms-client/src/main/java/org/netxms/client/objects/PollingTarget.java
new file mode 100644 (file)
index 0000000..993d8b3
--- /dev/null
@@ -0,0 +1,30 @@
+package org.netxms.client.objects;
+
+import org.netxms.client.constants.AgentCacheMode;
+
+/**
+ * Common interface, for all objects, that can be polled 
+ */
+public interface PollingTarget
+{
+   /**
+    * @return the objectId
+    */
+   public long getObjectId();
+
+   public int getIfXTablePolicy();
+
+   public AgentCacheMode getAgentCacheMode();
+
+   public int getFlags();
+
+   public long getPollerNodeId();
+
+   public Object getObjectName();
+
+   public boolean containAgent();
+
+   public boolean containInterfaces();
+
+   public boolean containPollerNode();   
+}
index 9f76092..319e78f 100644 (file)
@@ -149,7 +149,7 @@ public class VlanMap extends AbstractNetworkMapView
                if (iface != null)
                {
                        Node peerNode = (Node)session.findObjectById(iface.getPeerNodeId(), Node.class);
-                       if ((peerNode != null) && ((peerNode.getFlags() & Node.NF_IS_BRIDGE) != 0))
+                       if ((peerNode != null) && ((peerNode.getCapabilities() & Node.NC_IS_BRIDGE) != 0))
                        {
                                try
                                {
index 994eb8f..195ec93 100644 (file)
@@ -207,11 +207,11 @@ public class MapLabelProvider extends LabelProvider implements IFigureProvider,
                                switch(object.getObjectClass())
                                {
                                        case AbstractObject.OBJECT_NODE:
-                                               if ((((Node)object).getFlags() & Node.NF_IS_BRIDGE) != 0)
+                                               if ((((Node)object).getCapabilities() & Node.NC_IS_BRIDGE) != 0)
                                                        return imgNodeSwitch;
-                                               if ((((Node)object).getFlags() & Node.NF_IS_ROUTER) != 0)
+                                               if ((((Node)object).getCapabilities() & Node.NC_IS_ROUTER) != 0)
                                                        return imgNodeRouter;
-                                               if ((((Node)object).getFlags() & Node.NF_IS_PRINTER) != 0)
+                                               if ((((Node)object).getCapabilities() & Node.NC_IS_PRINTER) != 0)
                                                        return imgNodePrinter;
                                                if (((Node)object).getPlatformName().startsWith("windows")) //$NON-NLS-1$
                                                        return imgNodeWindows;
index 1ac7807..49c0665 100644 (file)
            </enabledWhen>
         </page>
         <page
-              class="org.netxms.ui.eclipse.objectmanager.propertypages.NodePolling"
+              class="org.netxms.ui.eclipse.objectmanager.propertypages.ObjectPolling"
               id="org.netxms.ui.eclipse.objectmanager.propertypages.NodePolling#20"
               name="%page.name.Polling">
            <enabledWhen>
               <instanceof
-                    value="org.netxms.client.objects.Node">
+                    value="org.netxms.client.objects.PollingTarget">
               </instanceof>
            </enabledWhen>
         </page>
                label="%action.label.BindTo"
                menubarPath="objectbinding">
          </action>
+         <menu
+               id="org.netxms.ui.eclipse.objectmanager.popupActions.PollMenu"
+               label="%menu.label.Poll"
+               path="objectmgmt">
+         </menu>
+         <action
+               class="org.netxms.ui.eclipse.objectmanager.actions.StatusPoll"
+               enablesFor="1"
+               id="org.netxms.ui.eclipse.objectmanager.popupActions.StatusPoll"
+               label="%action.label.StatusPoll"
+               menubarPath="org.netxms.ui.eclipse.objectmanager.popupActions.PollMenu/additions"
+               style="push">
+         </action>
+         <action
+               class="org.netxms.ui.eclipse.objectmanager.actions.NormalConfigurationPoll"
+               enablesFor="1"
+               id="org.netxms.ui.eclipse.objectmanager.popupActions.ConfigurationPoll"
+               label="%action.label.ConfPoll"
+               menubarPath="org.netxms.ui.eclipse.objectmanager.popupActions.PollMenu/additions"
+               style="push">
+         </action>
       </objectContribution>
       <objectContribution
             id="org.netxms.ui.eclipse.objectmanager.actions.popup.object.EntireNetwork"
                label="%action.label.BindTo"
                menubarPath="objectbinding">
          </action>
+         <menu
+               id="org.netxms.ui.eclipse.objectmanager.popupActions.PollMenu"
+               label="%menu.label.Poll"
+               path="objectmgmt">
+         </menu>
+         <action
+               class="org.netxms.ui.eclipse.objectmanager.actions.InstanceDiscoveryPoll"
+               enablesFor="1"
+               id="org.netxms.ui.eclipse.objectmanager.popupActions.InstanceDiscoveryPoll"
+               label="%action.label.InstanceDiscoveryPoll"
+               menubarPath="org.netxms.ui.eclipse.objectmanager.popupActions.PollMenu/additions"
+               style="push">
+         </action>
+         <action
+               class="org.netxms.ui.eclipse.objectmanager.actions.StatusPoll"
+               enablesFor="1"
+               id="org.netxms.ui.eclipse.objectmanager.popupActions.StatusPoll"
+               label="%action.label.StatusPoll"
+               menubarPath="org.netxms.ui.eclipse.objectmanager.popupActions.PollMenu/additions"
+               style="push">
+         </action>
+         <action
+               class="org.netxms.ui.eclipse.objectmanager.actions.NormalConfigurationPoll"
+               enablesFor="1"
+               id="org.netxms.ui.eclipse.objectmanager.popupActions.ConfigurationPoll"
+               label="%action.label.ConfPoll"
+               menubarPath="org.netxms.ui.eclipse.objectmanager.popupActions.PollMenu/additions"
+               style="push">
+         </action>
       </objectContribution>
       <objectContribution
             adaptable="false"
index 7e62b58..64a7a24 100644 (file)
@@ -27,7 +27,7 @@ import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PartInitException;
 import org.netxms.client.constants.NodePollType;
-import org.netxms.client.objects.AbstractNode;
+import org.netxms.client.objects.PollingTarget;
 import org.netxms.ui.eclipse.objectmanager.Messages;
 import org.netxms.ui.eclipse.objectmanager.views.NodePollerView;
 import org.netxms.ui.eclipse.tools.MessageDialogHelper;
@@ -38,7 +38,7 @@ import org.netxms.ui.eclipse.tools.MessageDialogHelper;
 public abstract class AbstractNodePoll implements IObjectActionDelegate
 {
        private IWorkbenchWindow window;
-       private AbstractNode node = null;
+       private PollingTarget traget = null;
        
        /* (non-Javadoc)
         * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
@@ -46,7 +46,7 @@ public abstract class AbstractNodePoll implements IObjectActionDelegate
        @Override
        public void run(IAction action)
        {
-               if (node == null)
+               if (traget == null)
                   return;
 
                String msg = getConfirmation();
@@ -58,7 +58,7 @@ public abstract class AbstractNodePoll implements IObjectActionDelegate
                
                try
                {
-                       NodePollerView view = (NodePollerView)window.getActivePage().showView(NodePollerView.ID, Long.toString(node.getObjectId()) + "&" + getPollType(), IWorkbenchPage.VIEW_ACTIVATE); //$NON-NLS-1$
+                       NodePollerView view = (NodePollerView)window.getActivePage().showView(NodePollerView.ID, Long.toString(traget.getObjectId()) + "&" + getPollType(), IWorkbenchPage.VIEW_ACTIVATE); //$NON-NLS-1$
                        view.startPoll();
                }
                catch(PartInitException e)
@@ -76,15 +76,15 @@ public abstract class AbstractNodePoll implements IObjectActionDelegate
                Object obj;
                if ((selection instanceof IStructuredSelection) &&
                    (((IStructuredSelection)selection).size() == 1) &&
-                        ((obj = ((IStructuredSelection)selection).getFirstElement()) instanceof AbstractNode))
+                        ((obj = ((IStructuredSelection)selection).getFirstElement()) instanceof PollingTarget))
                {
-                       node = (AbstractNode)obj;
+                  traget = (PollingTarget)obj;
                }
                else
                {
-                       node = null;
+                  traget = null;
                }
-               action.setEnabled(node != null);
+               action.setEnabled(traget != null);
        }
 
        /* (non-Javadoc)
index 6015f2f..fdfb02f 100644 (file)
@@ -21,7 +21,7 @@ package org.netxms.ui.eclipse.objectmanager.actions;
 import org.netxms.client.constants.NodePollType;
 
 /**
- * Start status poll
+ * Start topology poll
  *
  */
 public class TopologyPoll extends AbstractNodePoll
@@ -34,6 +34,7 @@ import org.netxms.client.NXCObjectModificationData;
 import org.netxms.client.NXCSession;
 import org.netxms.client.constants.AgentCacheMode;
 import org.netxms.client.objects.AbstractNode;
+import org.netxms.client.objects.PollingTarget;
 import org.netxms.ui.eclipse.jobs.ConsoleJob;
 import org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector;
 import org.netxms.ui.eclipse.objectmanager.Activator;
@@ -44,9 +45,9 @@ import org.netxms.ui.eclipse.tools.WidgetHelper;
 /**
  * "Polling" property page for nodes
  */
-public class NodePolling extends PropertyPage
+public class ObjectPolling extends PropertyPage
 {
-       private AbstractNode object;
+       private PollingTarget object;
        private ObjectSelector pollerNode;
        private Button radioIfXTableDefault;
        private Button radioIfXTableEnable;
@@ -65,41 +66,45 @@ public class NodePolling extends PropertyPage
        {
                Composite dialogArea = new Composite(parent, SWT.NONE);
                
-               object = (AbstractNode)getElement().getAdapter(AbstractNode.class);
+               object = (PollingTarget)getElement().getAdapter(PollingTarget.class);
                
                GridLayout layout = new GridLayout();
                layout.verticalSpacing = WidgetHelper.DIALOG_SPACING;
                layout.marginWidth = 0;
                layout.marginHeight = 0;
       dialogArea.setLayout(layout);
+      GridData gd = new GridData();
       
       /* poller node */
-      Group servicePollGroup = new Group(dialogArea, SWT.NONE);
-      servicePollGroup.setText(Messages.get().NodePolling_GroupNetSrv);
-               layout = new GridLayout();
-               layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
-               layout.numColumns = 2;
-               servicePollGroup.setLayout(layout);
-               GridData gd = new GridData();
-               gd.horizontalAlignment = SWT.FILL;
-               gd.grabExcessHorizontalSpace = true;
-               servicePollGroup.setLayoutData(gd);
-               
-               pollerNode = new ObjectSelector(servicePollGroup, SWT.NONE, true);
-               pollerNode.setLabel(Messages.get().NodePolling_PollerNode);
-               pollerNode.setObjectClass(AbstractNode.class);
-               pollerNode.setEmptySelectionName(Messages.get().NodePolling_EmptySelectionServer);
-               pollerNode.setObjectId(object.getPollerNodeId());
-               gd = new GridData();
-               gd.horizontalAlignment = SWT.FILL;
-               gd.grabExcessHorizontalSpace = true;
-               pollerNode.setLayoutData(gd);
-               
-               Label label = new Label(servicePollGroup, SWT.WRAP);
-               label.setText(Messages.get().NodePolling_PollerNodeDescription);
-               gd = new GridData();
-               gd.widthHint = 250;
-               label.setLayoutData(gd);
+      if(object.containPollerNode())
+      {
+         Group servicePollGroup = new Group(dialogArea, SWT.NONE);
+         servicePollGroup.setText(Messages.get().NodePolling_GroupNetSrv);
+               layout = new GridLayout();
+               layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
+               layout.numColumns = 2;
+               servicePollGroup.setLayout(layout);
+               gd = new GridData();
+               gd.horizontalAlignment = SWT.FILL;
+               gd.grabExcessHorizontalSpace = true;
+               servicePollGroup.setLayoutData(gd);
+               
+               pollerNode = new ObjectSelector(servicePollGroup, SWT.NONE, true);
+               pollerNode.setLabel(Messages.get().NodePolling_PollerNode);
+               pollerNode.setObjectClass(AbstractNode.class);
+               pollerNode.setEmptySelectionName(Messages.get().NodePolling_EmptySelectionServer);
+               pollerNode.setObjectId(object.getPollerNodeId());
+               gd = new GridData();
+               gd.horizontalAlignment = SWT.FILL;
+               gd.grabExcessHorizontalSpace = true;
+               pollerNode.setLayoutData(gd);
+               
+               Label label = new Label(servicePollGroup, SWT.WRAP);
+               label.setText(Messages.get().NodePolling_PollerNodeDescription);
+               gd = new GridData();
+               gd.widthHint = 250;
+               label.setLayoutData(gd);
+      }
 
                /* options */
                Group optionsGroup = new Group(dialogArea, SWT.NONE);
@@ -112,65 +117,78 @@ public class NodePolling extends PropertyPage
                gd.grabExcessHorizontalSpace = true;
                optionsGroup.setLayoutData(gd);
                
-               addFlag(optionsGroup, AbstractNode.NF_DISABLE_NXCP, Messages.get().NodePolling_OptDisableAgent);
-               addFlag(optionsGroup, AbstractNode.NF_DISABLE_SNMP, Messages.get().NodePolling_OptDisableSNMP);
-               addFlag(optionsGroup, AbstractNode.NF_DISABLE_ICMP, Messages.get().NodePolling_OptDisableICMP);
-               addFlag(optionsGroup, AbstractNode.NF_DISABLE_STATUS_POLL, Messages.get().NodePolling_OptDisableStatusPoll);
-               addFlag(optionsGroup, AbstractNode.NF_DISABLE_CONF_POLL, Messages.get().NodePolling_OptDisableConfigPoll);
-               addFlag(optionsGroup, AbstractNode.NF_DISABLE_ROUTE_POLL, Messages.get().NodePolling_OptDisableRTPoll);
-               addFlag(optionsGroup, AbstractNode.NF_DISABLE_TOPOLOGY_POLL, Messages.get().NodePolling_OptDisableTopoPoll);
-               addFlag(optionsGroup, AbstractNode.NF_DISABLE_DISCOVERY_POLL, Messages.get().NodePolling_OptDisableDiscoveryPoll);
-               addFlag(optionsGroup, AbstractNode.NF_DISABLE_DATA_COLLECT, Messages.get().NodePolling_OptDisableDataCollection);
+               if(object.containAgent())   
+                  addFlag(optionsGroup, AbstractNode.NF_DISABLE_NXCP, Messages.get().NodePolling_OptDisableAgent);
+               if(object.containInterfaces())
+               {
+               addFlag(optionsGroup, AbstractNode.NF_DISABLE_SNMP, Messages.get().NodePolling_OptDisableSNMP);
+               addFlag(optionsGroup, AbstractNode.NF_DISABLE_ICMP, Messages.get().NodePolling_OptDisableICMP);
+               }
+               addFlag(optionsGroup, AbstractNode.DCF_DISABLE_STATUS_POLL, Messages.get().NodePolling_OptDisableStatusPoll);
+               addFlag(optionsGroup, AbstractNode.DCF_DISABLE_CONF_POLL, Messages.get().NodePolling_OptDisableConfigPoll);
+      if(object.containInterfaces())
+      {
+               addFlag(optionsGroup, AbstractNode.NF_DISABLE_ROUTE_POLL, Messages.get().NodePolling_OptDisableRTPoll);
+               addFlag(optionsGroup, AbstractNode.NF_DISABLE_TOPOLOGY_POLL, Messages.get().NodePolling_OptDisableTopoPoll);
+               addFlag(optionsGroup, AbstractNode.NF_DISABLE_DISCOVERY_POLL, Messages.get().NodePolling_OptDisableDiscoveryPoll);
+      }
+               addFlag(optionsGroup, AbstractNode.DCF_DISABLE_DATA_COLLECT, Messages.get().NodePolling_OptDisableDataCollection);
                
                /* use ifXTable */
-               Group ifXTableGroup = new Group(dialogArea, SWT.NONE);
-               ifXTableGroup.setText(Messages.get().NodePolling_GroupIfXTable);
-               layout = new GridLayout();
-               layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
-               layout.numColumns = 3;
-               layout.makeColumnsEqualWidth = true;
-               ifXTableGroup.setLayout(layout);
-               gd = new GridData();
-               gd.horizontalAlignment = SWT.FILL;
-               gd.grabExcessHorizontalSpace = true;
-               ifXTableGroup.setLayoutData(gd);
-               
-               radioIfXTableDefault = new Button(ifXTableGroup, SWT.RADIO);
-               radioIfXTableDefault.setText(Messages.get().NodePolling_Default);
-               radioIfXTableDefault.setSelection(object.getIfXTablePolicy() == AbstractNode.IFXTABLE_DEFAULT);
-
-               radioIfXTableEnable = new Button(ifXTableGroup, SWT.RADIO);
-               radioIfXTableEnable.setText(Messages.get().NodePolling_Enable);
-               radioIfXTableEnable.setSelection(object.getIfXTablePolicy() == AbstractNode.IFXTABLE_ENABLED);
-
-               radioIfXTableDisable = new Button(ifXTableGroup, SWT.RADIO);
-               radioIfXTableDisable.setText(Messages.get().NodePolling_Disable);
-               radioIfXTableDisable.setSelection(object.getIfXTablePolicy() == AbstractNode.IFXTABLE_DISABLED);
+               if(object.containInterfaces())
+               {
+               Group ifXTableGroup = new Group(dialogArea, SWT.NONE);
+               ifXTableGroup.setText(Messages.get().NodePolling_GroupIfXTable);
+               layout = new GridLayout();
+               layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
+               layout.numColumns = 3;
+               layout.makeColumnsEqualWidth = true;
+               ifXTableGroup.setLayout(layout);
+               gd = new GridData();
+               gd.horizontalAlignment = SWT.FILL;
+               gd.grabExcessHorizontalSpace = true;
+               ifXTableGroup.setLayoutData(gd);
+               
+               radioIfXTableDefault = new Button(ifXTableGroup, SWT.RADIO);
+               radioIfXTableDefault.setText(Messages.get().NodePolling_Default);
+               radioIfXTableDefault.setSelection(object.getIfXTablePolicy() == AbstractNode.IFXTABLE_DEFAULT);
+   
+               radioIfXTableEnable = new Button(ifXTableGroup, SWT.RADIO);
+               radioIfXTableEnable.setText(Messages.get().NodePolling_Enable);
+               radioIfXTableEnable.setSelection(object.getIfXTablePolicy() == AbstractNode.IFXTABLE_ENABLED);
+   
+               radioIfXTableDisable = new Button(ifXTableGroup, SWT.RADIO);
+               radioIfXTableDisable.setText(Messages.get().NodePolling_Disable);
+               radioIfXTableDisable.setSelection(object.getIfXTablePolicy() == AbstractNode.IFXTABLE_DISABLED);
+               }
 
-      /* agent cache */
-      Group agentCacheGroup = new Group(dialogArea, SWT.NONE);
-      agentCacheGroup.setText(Messages.get().NodePolling_AgentCacheMode);
-      layout = new GridLayout();
-      layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
-      layout.numColumns = 3;
-      layout.makeColumnsEqualWidth = true;
-      agentCacheGroup.setLayout(layout);
-      gd = new GridData();
-      gd.horizontalAlignment = SWT.FILL;
-      gd.grabExcessHorizontalSpace = true;
-      agentCacheGroup.setLayoutData(gd);
+      /* agent cache */      
+      if(object.containAgent())      
+      {
+         Group agentCacheGroup = new Group(dialogArea, SWT.NONE);
+         agentCacheGroup.setText(Messages.get().NodePolling_AgentCacheMode);
+         layout = new GridLayout();
+         layout.horizontalSpacing = WidgetHelper.DIALOG_SPACING;
+         layout.numColumns = 3;
+         layout.makeColumnsEqualWidth = true;
+         agentCacheGroup.setLayout(layout);
+         gd = new GridData();
+         gd.horizontalAlignment = SWT.FILL;
+         gd.grabExcessHorizontalSpace = true;
+         agentCacheGroup.setLayoutData(gd);
       
-      radioAgentCacheDefault = new Button(agentCacheGroup, SWT.RADIO);
-      radioAgentCacheDefault.setText(Messages.get().NodePolling_Default);
-      radioAgentCacheDefault.setSelection(object.getAgentCacheMode() == AgentCacheMode.DEFAULT);
-
-      radioAgentCacheOn = new Button(agentCacheGroup, SWT.RADIO);
-      radioAgentCacheOn.setText(Messages.get().NodePolling_On);
-      radioAgentCacheOn.setSelection(object.getAgentCacheMode() == AgentCacheMode.ON);
-
-      radioAgentCacheOff = new Button(agentCacheGroup, SWT.RADIO);
-      radioAgentCacheOff.setText(Messages.get().NodePolling_Off);
-      radioAgentCacheOff.setSelection(object.getAgentCacheMode() == AgentCacheMode.OFF);
+         radioAgentCacheDefault = new Button(agentCacheGroup, SWT.RADIO);
+         radioAgentCacheDefault.setText(Messages.get().NodePolling_Default);
+         radioAgentCacheDefault.setSelection(object.getAgentCacheMode() == AgentCacheMode.DEFAULT);
+   
+         radioAgentCacheOn = new Button(agentCacheGroup, SWT.RADIO);
+         radioAgentCacheOn.setText(Messages.get().NodePolling_On);
+         radioAgentCacheOn.setSelection(object.getAgentCacheMode() == AgentCacheMode.ON);
+   
+         radioAgentCacheOff = new Button(agentCacheGroup, SWT.RADIO);
+         radioAgentCacheOff.setText(Messages.get().NodePolling_Off);
+         radioAgentCacheOff.setSelection(object.getAgentCacheMode() == AgentCacheMode.OFF);
+      }
 
       return dialogArea;
        }
@@ -263,11 +281,13 @@ public class NodePolling extends PropertyPage
        protected boolean applyChanges(final boolean isApply)
        {
                final NXCObjectModificationData md = new NXCObjectModificationData(object.getObjectId());
-               
-               md.setPollerNode(pollerNode.getObjectId());
+               if(object.containPollerNode())
+                  md.setPollerNode(pollerNode.getObjectId());
                md.setObjectFlags(collectNodeFlags(), collectNodeFlagsMask());
-               md.setIfXTablePolicy(collectIfXTablePolicy());
-               md.setAgentCacheMode(collectAgentCacheMode());
+               if(object.containInterfaces())
+                  md.setIfXTablePolicy(collectIfXTablePolicy());
+               if(object.containAgent())
+                  md.setAgentCacheMode(collectAgentCacheMode());
                
                if (isApply)
                        setValid(false);
@@ -295,7 +315,7 @@ public class NodePolling extends PropertyPage
                                                @Override
                                                public void run()
                                                {
-                                                       NodePolling.this.setValid(true);
+                                                       ObjectPolling.this.setValid(true);
                                                }
                                        });
                                }
index e35d107..21dee37 100644 (file)
@@ -48,6 +48,7 @@ import org.netxms.client.TextOutputListener;
 import org.netxms.client.constants.NodePollType;
 import org.netxms.client.objects.AbstractNode;
 import org.netxms.client.objects.AbstractObject;
+import org.netxms.client.objects.PollingTarget;
 import org.netxms.ui.eclipse.console.resources.RegionalSettings;
 import org.netxms.ui.eclipse.console.resources.SharedIcons;
 import org.netxms.ui.eclipse.objectmanager.Messages;
@@ -76,7 +77,7 @@ public class NodePollerView extends ViewPart
    private static final Color COLOR_LOCAL = new Color(Display.getCurrent(), 0, 0, 192);
 
    private NXCSession session;
-   private AbstractNode node;
+   private PollingTarget target;
    private NodePollType pollType;
    private Display display;
    private StyledText textArea;
@@ -103,12 +104,12 @@ public class NodePollerView extends ViewPart
          throw new PartInitException("Internal error"); //$NON-NLS-1$
 
       AbstractObject obj = session.findObjectById(Long.parseLong(parts[0]));
-      node = ((obj != null) && (obj instanceof AbstractNode)) ? (AbstractNode)obj : null;
-      if (node == null)
+      target = ((obj != null) && (obj instanceof PollingTarget)) ? (PollingTarget)obj : null;
+      if (target == null)
          throw new PartInitException(Messages.get().NodePollerView_InvalidObjectID);
       pollType = NodePollType.valueOf(parts[1]);
 
-      setPartName(POLL_NAME[pollType.getValue()] + " - " + node.getObjectName()); //$NON-NLS-1$
+      setPartName(POLL_NAME[pollType.getValue()] + " - " + target.getObjectName()); //$NON-NLS-1$
    }
 
    /*
@@ -331,13 +332,13 @@ public class NodePollerView extends ViewPart
          }
       };
 
-      Job job = new Job(String.format(Messages.get().NodePollerView_JobName, node.getObjectName(), node.getObjectId())) {
+      Job job = new Job(String.format(Messages.get().NodePollerView_JobName, target.getObjectName(), target.getObjectId())) {
          @Override
          protected IStatus run(IProgressMonitor monitor)
          {
             try
             {
-               session.pollNode(node.getObjectId(), pollType, listener);
+               session.pollNode(target.getObjectId(), pollType, listener);
                onPollComplete(true, null);
             }
             catch(Exception e)
index d943872..91bbedf 100644 (file)
@@ -35,6 +35,7 @@ import org.netxms.ui.eclipse.objectbrowser.widgets.ObjectSelector;
 import org.netxms.ui.eclipse.objectmanager.Messages;
 import org.netxms.ui.eclipse.tools.WidgetHelper;
 import org.netxms.ui.eclipse.widgets.LabeledText;
+
 /**
  * Common sensor changeable fields
  */
@@ -49,71 +50,74 @@ public class SensorCommon extends Composite
    private LabeledText textDescription;
    private ObjectSelector selectorProxyNode;
    private ModifyListener modifyListener = null;
-   
+   private int commProtocol;
+
    public SensorCommon(Composite parent, int style, IWizard wizard)
    {
-      this(parent, style, wizard, "", 0, "", "", "", "", "",0,0);
+      this(parent, style, wizard, "", 0, "", "", "", "", "", 0, 0);
    }
-   
+
    /**
     * Common sensor changeable field constructor
-    *  
+    * 
     * @param parent
     * @param style
     */
-   public SensorCommon(Composite parent, int style, final IWizard wizard, String mac, int devClass, String vendor, String serial, String devAddress, String metaType, String desc, long proxyNodeId, int commProto)
+   public SensorCommon(Composite parent, int style, final IWizard wizard, String mac, int devClass, String vendor, String serial,
+         String devAddress, String metaType, String desc, long proxyNodeId, int commProto)
    {
       super(parent, style);
-      
+      commProtocol = commProto;
+
       GridLayout layout = new GridLayout();
       layout.marginHeight = 0;
       layout.marginWidth = 0;
       layout.numColumns = 2;
       setLayout(layout);
-      
+
       selectorProxyNode = new ObjectSelector(this, SWT.NONE, true);
       selectorProxyNode.setLabel(Messages.get().SensorWizard_General_Proxy);
       selectorProxyNode.setObjectClass(Node.class);
       selectorProxyNode.setClassFilter(ObjectSelectionDialog.createNodeSelectionFilter(false));
       selectorProxyNode.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
-      if(proxyNodeId != 0)
+      if (proxyNodeId != 0)
          selectorProxyNode.setObjectId(proxyNodeId);
-      
+
       textMacAddress = new LabeledText(this, SWT.NONE);
       textMacAddress.setLabel(Messages.get().SensorWizard_General_MacAddr);
       textMacAddress.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
       textMacAddress.setEditable(commProto != Sensor.COMM_LORAWAN);
-      
-      comboDeviceClass = WidgetHelper.createLabeledCombo(this, SWT.BORDER | SWT.READ_ONLY, Messages.get().SensorWizard_General_DeviceClass, 
-            WidgetHelper.DEFAULT_LAYOUT_DATA);
+
+      comboDeviceClass = WidgetHelper.createLabeledCombo(this, SWT.BORDER | SWT.READ_ONLY,
+            Messages.get().SensorWizard_General_DeviceClass, WidgetHelper.DEFAULT_LAYOUT_DATA);
       comboDeviceClass.setItems(Sensor.DEV_CLASS_NAMES);
       comboDeviceClass.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-      
+
       textVendor = new LabeledText(this, SWT.NONE);
       textVendor.setLabel(Messages.get().SensorWizard_General_Vendor);
       textVendor.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-      
+
       textSerial = new LabeledText(this, SWT.NONE);
       textSerial.setLabel(Messages.get().SensorWizard_General_Serial);
       textSerial.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-      
+
       textDeviceAddress = new LabeledText(this, SWT.NONE);
       textDeviceAddress.setLabel(Messages.get().SensorWizard_General_DeviceAddr);
       textDeviceAddress.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
       textDeviceAddress.setEnabled(commProto != Sensor.COMM_LORAWAN);
-      
+
       textMetaType = new LabeledText(this, SWT.NONE);
       textMetaType.setLabel(Messages.get().SensorWizard_General_MetaType);
       textMetaType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
-      
+
       textDescription = new LabeledText(this, SWT.NONE);
       textDescription.setLabel(Messages.get().SensorWizard_General_DescrLabel);
       textDescription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
       updateFields(mac, devClass, vendor, serial, devAddress, metaType, desc);
-      
+
       if (wizard != null)
       {
-         modifyListener = new ModifyListener() {         
+         modifyListener = new ModifyListener() {
             @Override
             public void modifyText(ModifyEvent e)
             {
@@ -125,10 +129,9 @@ public class SensorCommon extends Composite
          textMacAddress.getTextControl().addModifyListener(modifyListener);
          textDeviceAddress.getTextControl().addModifyListener(modifyListener);
       }
-      
-      
+
    }
-   
+
    public void updateFields(String mac, int devClass, String vendor, String serial, String devAddress, String metaType, String desc)
    {
       textMacAddress.setText(mac);
@@ -138,19 +141,25 @@ public class SensorCommon extends Composite
       textDeviceAddress.setText(devAddress);
       textMetaType.setText(metaType);
       textDescription.setText(desc);
-      
+
    }
-   
+
    /**
     * Check if all required fields are filled
+    * 
     * @return true if page is valid
     */
    public boolean validate()
-   {
-      return (selectorProxyNode.getObjectId() != 0)
-            && ((textMacAddress.getText().length() >= 12
-            && textMacAddress.getText().length() <= 23)
-            || (textDeviceAddress.getText().length() > 0));
+   {   
+      if(commProtocol == Sensor.COMM_LORAWAN && 
+            (textMacAddress.getText() == null || textDeviceAddress.getText().length() == 0 || textDeviceAddress.getText().length() == 0))
+         return false;
+      if(commProtocol != Sensor.SENSOR_PROTO_UNKNOWN && selectorProxyNode.getObjectId() == 0)
+         return false;
+      if(textMacAddress.getText().length() > 0 && !(textMacAddress.getText().length() >= 12
+            && textMacAddress.getText().length() <= 23))
+         return false;
+      return true;
    }
 
    /**
@@ -158,7 +167,7 @@ public class SensorCommon extends Composite
     */
    public MacAddress getMacAddress()
    {
-      if(textMacAddress.getText().isEmpty())
+      if (textMacAddress.getText().isEmpty())
          return null;
       try
       {
@@ -217,7 +226,7 @@ public class SensorCommon extends Composite
    {
       return textDescription.getText();
    }
-   
+
    public long getProxyNode()
    {
       return selectorProxyNode.getObjectId();
index ac10b1b..ccfea0f 100644 (file)
@@ -309,7 +309,7 @@ public class ComponentsTab extends ObjectTab
        {
                if (object instanceof Node)
                {
-                       return (((Node)object).getFlags() & Node.NF_HAS_ENTITY_MIB) != 0;
+                       return (((Node)object).getCapabilities() & Node.NC_HAS_ENTITY_MIB) != 0;
                }
                return false;
        }
index 9cb15f1..9c4a25c 100644 (file)
@@ -58,21 +58,21 @@ public class Capabilities extends TableElement
                        return;
                
                AbstractNode node = (AbstractNode)getObject();
-               addFlag(Messages.get().Capabilities_FlagIsAgent, (node.getFlags() & AbstractNode.NF_IS_NATIVE_AGENT) != 0);
-               addFlag(Messages.get().Capabilities_FlagIsBridge, (node.getFlags() & AbstractNode.NF_IS_BRIDGE) != 0);
-               addFlag(Messages.get().Capabilities_FlagIsCDP, (node.getFlags() & AbstractNode.NF_IS_CDP) != 0);
-               addFlag(Messages.get().Capabilities_FlagIsDot1x, (node.getFlags() & AbstractNode.NF_IS_8021X) != 0);
-               addFlag(Messages.get().Capabilities_FlagIsLLDP, (node.getFlags() & AbstractNode.NF_IS_LLDP) != 0);
-               addFlag(Messages.get().Capabilities_FlagIsNDP, (node.getFlags() & AbstractNode.NF_IS_SONMP) != 0);
-               addFlag(Messages.get().Capabilities_FlagIsPrinter, (node.getFlags() & AbstractNode.NF_IS_PRINTER) != 0);
-               addFlag(Messages.get().Capabilities_FlagIsRouter, (node.getFlags() & AbstractNode.NF_IS_ROUTER) != 0);
-               addFlag(Messages.get().Capabilities_FlagIsSMCLP, (node.getFlags() & AbstractNode.NF_IS_SMCLP) != 0);
-               addFlag(Messages.get().Capabilities_FlagIsSNMP, (node.getFlags() & AbstractNode.NF_IS_SNMP) != 0);
-               addFlag(Messages.get().Capabilities_FlagIsSTP, (node.getFlags() & AbstractNode.NF_IS_STP) != 0);
-               addFlag(Messages.get().Capabilities_FlagIsVRRP, (node.getFlags() & AbstractNode.NF_IS_VRRP) != 0);
-               addFlag(Messages.get().Capabilities_FlagHasEntityMIB, (node.getFlags() & AbstractNode.NF_HAS_ENTITY_MIB) != 0);
-               addFlag(Messages.get().Capabilities_FlagHasIfXTable, (node.getFlags() & AbstractNode.NF_HAS_IFXTABLE) != 0);
-               if ((node.getFlags() & AbstractNode.NF_IS_SNMP) != 0)
+               addFlag(Messages.get().Capabilities_FlagIsAgent, (node.getCapabilities() & AbstractNode.NC_IS_NATIVE_AGENT) != 0);
+               addFlag(Messages.get().Capabilities_FlagIsBridge, (node.getCapabilities() & AbstractNode.NC_IS_BRIDGE) != 0);
+               addFlag(Messages.get().Capabilities_FlagIsCDP, (node.getCapabilities() & AbstractNode.NC_IS_CDP) != 0);
+               addFlag(Messages.get().Capabilities_FlagIsDot1x, (node.getCapabilities() & AbstractNode.NC_IS_8021X) != 0);
+               addFlag(Messages.get().Capabilities_FlagIsLLDP, (node.getCapabilities() & AbstractNode.NC_IS_LLDP) != 0);
+               addFlag(Messages.get().Capabilities_FlagIsNDP, (node.getCapabilities() & AbstractNode.NC_IS_NDP) != 0);
+               addFlag(Messages.get().Capabilities_FlagIsPrinter, (node.getCapabilities() & AbstractNode.NC_IS_PRINTER) != 0);
+               addFlag(Messages.get().Capabilities_FlagIsRouter, (node.getCapabilities() & AbstractNode.NC_IS_ROUTER) != 0);
+               addFlag(Messages.get().Capabilities_FlagIsSMCLP, (node.getCapabilities() & AbstractNode.NC_IS_SMCLP) != 0);
+               addFlag(Messages.get().Capabilities_FlagIsSNMP, (node.getCapabilities() & AbstractNode.NC_IS_SNMP) != 0);
+               addFlag(Messages.get().Capabilities_FlagIsSTP, (node.getCapabilities() & AbstractNode.NC_IS_STP) != 0);
+               addFlag(Messages.get().Capabilities_FlagIsVRRP, (node.getCapabilities() & AbstractNode.NC_IS_VRRP) != 0);
+               addFlag(Messages.get().Capabilities_FlagHasEntityMIB, (node.getCapabilities() & AbstractNode.NC_HAS_ENTITY_MIB) != 0);
+               addFlag(Messages.get().Capabilities_FlagHasIfXTable, (node.getCapabilities() & AbstractNode.NC_HAS_IFXTABLE) != 0);
+               if ((node.getCapabilities() & AbstractNode.NC_IS_SNMP) != 0)
                {
                        addPair(Messages.get().Capabilities_SNMPPort, Integer.toString(node.getSnmpPort()));
                        addPair(Messages.get().Capabilities_SNMPVersion, getSnmpVersionName(node.getSnmpVersion()));
index 574ee0b..d9d8821 100644 (file)
@@ -151,14 +151,14 @@ public class GeneralInfo extends TableElement
                                addPair(Messages.get().GeneralInfo_SysOID, node.getSnmpOID(), false);
             addPair(Messages.get().GeneralInfo_SNMPsysLocation, node.getSnmpSysLocation(), false);
             addPair(Messages.get().GeneralInfo_SNMPsysContact, node.getSnmpSysContact(), false);
-                               if ((node.getFlags() & AbstractNode.NF_IS_BRIDGE) != 0)
+                               if ((node.getCapabilities() & AbstractNode.NC_IS_BRIDGE) != 0)
                                        addPair(Messages.get().GeneralInfo_BridgeBaseAddress, node.getBridgeBaseAddress().toString());
                                addPair(Messages.get().GeneralInfo_Driver, node.getDriverName(), false);
             addPair(Messages.get().GeneralInfo_NodeType, node.getNodeType().toString(), false);
             if (node.getBootTime() != null)
                addPair(Messages.get().GeneralInfo_BootTime, RegionalSettings.getDateTimeFormat().format(node.getBootTime()), false);
             if (node.hasAgent())
-               addPair(Messages.get().GeneralInfo_AgentStatus, (node.getRuntimeFlags() & Node.NDF_AGENT_UNREACHABLE) != 0 ? Messages.get().GeneralInfo_Unreachable : Messages.get().GeneralInfo_Connected);
+               addPair(Messages.get().GeneralInfo_AgentStatus, (node.getStateFlags() & Node.NSF_AGENT_UNREACHABLE) != 0 ? Messages.get().GeneralInfo_Unreachable : Messages.get().GeneralInfo_Connected);
             if (node.getLastAgentCommTime() != null)
                addPair(Messages.get().GeneralInfo_LastAgentContact, RegionalSettings.getDateTimeFormat().format(node.getLastAgentCommTime()), false);
             if (node.getRackId() != 0)
index 83c9dee..1c6cb30 100644 (file)
@@ -125,7 +125,7 @@ public class Ports extends ObjectTab implements ISelectionProvider
        {
                if (object instanceof Node)
                {
-                       if ((((Node)object).getFlags() & Node.NF_IS_BRIDGE) != 0)
+                       if ((((Node)object).getCapabilities() & Node.NC_IS_BRIDGE) != 0)
                                return true;
                }
                return false;
index fe5e8e3..7aedef4 100644 (file)
@@ -49,7 +49,7 @@ public class MacAddress
         */
        public MacAddress(byte[] src)
        {
-               if (src != null)
+               if (src != null && src.length > 0)
                {
                        value = Arrays.copyOf(src, src.length);
                }
index 2f8fa52..48f0d24 100644 (file)
@@ -987,6 +987,8 @@ public class NXCPCodes
    public static final long VID_LORA_APP_S_KEY = 598;
    public static final long VID_LORA_NWK_S_KWY = 599;
    public static final long VID_DCI_NAME = 600;
+   public static final long VID_STATE_FLAGS = 601;
+   public static final long VID_CAPABILITIES = 602;
 
        public static final long VID_ACL_USER_BASE = 0x00001000L;
        public static final long VID_ACL_USER_LAST = 0x00001FFFL;
index 2cbad3c..54323ea 100644 (file)
@@ -33,8 +33,8 @@ AccessPoint::AccessPoint() : DataCollectionTarget()
        m_model = NULL;
        m_serialNumber = NULL;
        m_radioInterfaces = NULL;
-   m_state = AP_ADOPTED;
-   m_prevState = m_state;
+       m_apState = AP_ADOPTED;
+   m_prevState = m_apState;
 }
 
 /**
@@ -49,8 +49,8 @@ AccessPoint::AccessPoint(const TCHAR *name, UINT32 index, const BYTE *macAddr) :
        m_model = NULL;
        m_serialNumber = NULL;
        m_radioInterfaces = NULL;
-   m_state = AP_ADOPTED;
-   m_prevState = m_state;
+       m_apState = AP_ADOPTED;
+   m_prevState = m_apState;
        m_isHidden = true;
 }
 
@@ -89,8 +89,8 @@ bool AccessPoint::loadFromDatabase(DB_HANDLE hdb, UINT32 dwId)
        m_model = DBGetField(hResult, 0, 2, NULL, 0);
        m_serialNumber = DBGetField(hResult, 0, 3, NULL, 0);
        m_nodeId = DBGetFieldULong(hResult, 0, 4);
-   m_state = (AccessPointState)DBGetFieldLong(hResult, 0, 5);
-   m_prevState = (m_state != AP_DOWN) ? m_state : AP_ADOPTED;
+       m_apState = (AccessPointState)DBGetFieldLong(hResult, 0, 5);
+   m_prevState = (m_apState != AP_DOWN) ? m_apState : AP_ADOPTED;
    m_index = DBGetFieldULong(hResult, 0, 6);
        DBFreeResult(hResult);
 
@@ -153,7 +153,7 @@ BOOL AccessPoint::saveToDatabase(DB_HANDLE hdb)
                DBBind(hStmt, 3, DB_SQLTYPE_VARCHAR, CHECK_NULL_EX(m_model), DB_BIND_STATIC);
                DBBind(hStmt, 4, DB_SQLTYPE_VARCHAR, CHECK_NULL_EX(m_serialNumber), DB_BIND_STATIC);
                DBBind(hStmt, 5, DB_SQLTYPE_INTEGER, m_nodeId);
-               DBBind(hStmt, 6, DB_SQLTYPE_INTEGER, (INT32)m_state);
+               DBBind(hStmt, 6, DB_SQLTYPE_INTEGER, (INT32)m_apState);
                DBBind(hStmt, 7, DB_SQLTYPE_INTEGER, m_index);
                DBBind(hStmt, 8, DB_SQLTYPE_INTEGER, m_id);
 
@@ -209,7 +209,7 @@ void AccessPoint::fillMessageInternal(NXCPMessage *msg)
        msg->setField(VID_VENDOR, CHECK_NULL_EX(m_vendor));
        msg->setField(VID_MODEL, CHECK_NULL_EX(m_model));
        msg->setField(VID_SERIAL_NUMBER, CHECK_NULL_EX(m_serialNumber));
-   msg->setField(VID_STATE, (UINT16)m_state);
+   msg->setField(VID_STATE, (UINT16)m_apState);
    msg->setField(VID_AP_INDEX, m_index);
 
    if (m_radioInterfaces != NULL)
@@ -389,13 +389,13 @@ void AccessPoint::updateInfo(const TCHAR *vendor, const TCHAR *model, const TCHA
  */
 void AccessPoint::updateState(AccessPointState state)
 {
-   if (state == m_state)
+   if (state == m_apState)
       return;
 
        lockProperties();
    if (state == AP_DOWN)
-      m_prevState = m_state;
-   m_state = state;
+      m_prevState = m_apState;
+   m_apState = state;
    if (m_status != STATUS_UNMANAGED)
    {
       switch(state)
@@ -625,7 +625,7 @@ json_t *AccessPoint::toJson()
    json_object_set_new(root, "model", json_string_t(m_model));
    json_object_set_new(root, "serialNumber", json_string_t(m_serialNumber));
    json_object_set_new(root, "radioInterfaces", json_object_array(m_radioInterfaces));
-   json_object_set_new(root, "state", json_integer(m_state));
+   json_object_set_new(root, "state", json_integer(m_apState));
    json_object_set_new(root, "prevState", json_integer(m_prevState));
    return root;
 }
index 4738cb6..55eddbb 100644 (file)
@@ -91,7 +91,7 @@ static UINT32 CDPTopoHandler(SNMP_Variable *var, SNMP_Transport *transport, void
  */
 void AddCDPNeighbors(Node *node, LinkLayerNeighbors *nbs)
 {
-       if (!(node->getFlags() & NF_IS_CDP))
+       if (!(node->getCapabilities() & NC_IS_CDP))
                return;
 
        DbgPrintf(5, _T("CDP: collecting topology information for node %s [%d]"), node->getName(), node->getId());
index 63a384d..e7d7eab 100644 (file)
@@ -31,8 +31,6 @@ Cluster::Cluster() : DataCollectionTarget()
    m_syncNetworks = new ObjectArray<InetAddress>(8, 8, true);
        m_dwNumResources = 0;
        m_pResourceList = NULL;
-       m_lastStatusPoll = 0;
-   m_lastConfigurationPoll = 0;
        m_zoneUIN = 0;
 }
 
@@ -45,8 +43,6 @@ Cluster::Cluster(const TCHAR *pszName, UINT32 zoneUIN) : DataCollectionTarget(ps
    m_syncNetworks = new ObjectArray<InetAddress>(8, 8, true);
        m_dwNumResources = 0;
        m_pResourceList = NULL;
-   m_lastStatusPoll = 0;
-   m_lastConfigurationPoll = 0;
        m_zoneUIN = zoneUIN;
 }
 
@@ -413,6 +409,9 @@ void Cluster::fillMessageInternal(NXCPMessage *pMsg)
  */
 UINT32 Cluster::modifyFromMessageInternal(NXCPMessage *pRequest)
 {
+   if (pRequest->isFieldExist(VID_FLAGS))
+      m_flags = pRequest->getFieldAsUInt32(VID_FLAGS);
+
    // Change cluster type
    if (pRequest->isFieldExist(VID_CLUSTER_TYPE))
       m_dwClusterType = pRequest->getFieldAsUInt32(VID_CLUSTER_TYPE);
@@ -516,49 +515,50 @@ bool Cluster::isVirtualAddr(const InetAddress& addr)
 }
 
 /**
- * Entry point for configuration poller thread
- */
-void Cluster::configurationPoll(PollerInfo *poller)
-{
-   poller->startExecution();
-   ObjectTransactionStart();
-   configurationPoll(NULL, 0, poller);
-   ObjectTransactionEnd();
-   delete poller;
-}
-
-/**
  * Configuration poll
  */
 void Cluster::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller)
 {
+   if (m_runtimeFlags & DCDF_DELETE_IN_PROGRESS)
+   {
+      if (dwRqId == 0)
+         m_runtimeFlags &= ~DCDF_QUEUED_FOR_STATUS_POLL;
+      return;
+   }
+
+   poller->setStatus(_T("wait for lock"));
+   pollerLock();
+
    if (IsShutdownInProgress())
+   {
+      pollerUnlock();
       return;
+   }
 
+   m_pollRequestor = pSession;
+   sendPollerMsg(dwRqId, _T("CLUSTER STATUS POLL [%s]: Applying templates\r\n"), m_name);
    DbgPrintf(6, _T("CLUSTER STATUS POLL [%s]: Applying templates"), m_name);
    if (ConfigReadInt(_T("ClusterTemplateAutoApply"), 0))
       applyUserTemplates();
 
+   sendPollerMsg(dwRqId, _T("CLUSTER STATUS POLL [%s]: Updating container bindings\r\n"), m_name);
    DbgPrintf(6, _T("CLUSTER STATUS POLL [%s]: Updating container bindings"), m_name);
    if (ConfigReadInt(_T("ClusterContainerAutoBind"), 0))
       updateContainerMembership();
 
    lockProperties();
    m_lastConfigurationPoll = time(NULL);
-   m_flags &= ~CLF_QUEUED_FOR_CONFIGURATION_POLL;
+   m_runtimeFlags &= ~DCDF_QUEUED_FOR_CONFIGURATION_POLL;
    unlockProperties();
 
+   poller->setStatus(_T("hook"));
+   executeHookScript(_T("ConfigurationPoll"));
+
+   sendPollerMsg(dwRqId, _T("CLUSTER CONFIGURATION POLL [%s]: Finished\r\n"), m_name);
    DbgPrintf(6, _T("CLUSTER CONFIGURATION POLL [%s]: Finished"), m_name);
-}
 
-/**
- * Entry point for status poller thread
- */
-void Cluster::statusPoll(PollerInfo *poller)
-{
-   poller->startExecution();
-   statusPoll(NULL, 0, poller);
-   delete poller;
+   pollerUnlock();
+   m_runtimeFlags |= DCDF_CONFIGURATION_POLL_PASSED;
 }
 
 /**
@@ -566,8 +566,21 @@ void Cluster::statusPoll(PollerInfo *poller)
  */
 void Cluster::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller)
 {
+   if (m_runtimeFlags & DCDF_DELETE_IN_PROGRESS)
+   {
+      if (dwRqId == 0)
+         m_runtimeFlags &= ~DCDF_QUEUED_FOR_STATUS_POLL;
+      return;
+   }
+
+   poller->setStatus(_T("wait for lock"));
+   pollerLock();
+
    if (IsShutdownInProgress())
+   {
+      pollerUnlock();
       return;
+   }
 
        int i, pollListSize;
        InterfaceList *pIfList;
@@ -592,6 +605,8 @@ void Cluster::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *pol
    unlockChildList();
 
        // Perform status poll on all member nodes
+   m_pollRequestor = pSession;
+   sendPollerMsg(dwRqId, _T("CLUSTER STATUS POLL [%s]: Polling member nodes\r\n"), m_name);
        DbgPrintf(6, _T("CLUSTER STATUS POLL [%s]: Polling member nodes"), m_name);
        for(i = 0, bAllDown = TRUE; i < pollListSize; i++)
        {
@@ -602,17 +617,17 @@ void Cluster::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *pol
 
        if (bAllDown)
        {
-               if (!(m_flags & CLF_DOWN))
+               if (!(m_state & CLSF_DOWN))
                {
-                  m_flags |= CLF_DOWN;
+                  m_state |= CLSF_DOWN;
                        PostEvent(EVENT_CLUSTER_DOWN, m_id, NULL);
                }
        }
        else
        {
-               if (m_flags & CLF_DOWN)
+               if (m_state & CLSF_DOWN)
                {
-                  m_flags &= ~CLF_DOWN;
+                  m_state &= ~CLSF_DOWN;
                        PostEvent(EVENT_CLUSTER_UP, m_id, NULL);
                }
        }
@@ -623,6 +638,7 @@ void Cluster::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *pol
                pbResourceFound = (BYTE *)malloc(m_dwNumResources);
                memset(pbResourceFound, 0, m_dwNumResources);
 
+          sendPollerMsg(dwRqId, _T("CLUSTER STATUS POLL [%s]: Polling resources\r\n"), m_name);
                DbgPrintf(6, _T("CLUSTER STATUS POLL [%s]: Polling resources"), m_name);
                for(i = 0; i < pollListSize; i++)
                {
@@ -638,6 +654,7 @@ void Cluster::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *pol
                                                {
                                                        if (m_pResourceList[k].dwCurrOwner != ppPollList[i]->getId())
                                                        {
+                                                     sendPollerMsg(dwRqId, _T("CLUSTER STATUS POLL [%s]: Resource %s owner changed\r\n"), m_name, m_pResourceList[k].szName);
                                                                DbgPrintf(5, _T("CLUSTER STATUS POLL [%s]: Resource %s owner changed"),
                                                                                         m_name, m_pResourceList[k].szName);
 
@@ -673,6 +690,7 @@ void Cluster::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *pol
                        }
                        else
                        {
+                     sendPollerMsg(dwRqId, _T("CLUSTER STATUS POLL [%s]: Cannot get interface list from %s\r\n"), m_name, ppPollList[i]->getName());
                                DbgPrintf(6, _T("CLUSTER STATUS POLL [%s]: Cannot get interface list from %s"),
                                                         m_name, ppPollList[i]->getName());
                        }
@@ -699,6 +717,13 @@ void Cluster::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *pol
                free(pbResourceFound);
        }
 
+
+   // Execute hook script
+   poller->setStatus(_T("hook"));
+   executeHookScript(_T("StatusPoll"));
+
+   calculateCompoundStatus(true);
+   poller->setStatus(_T("cleanup"));
        // Cleanup
        for(i = 0; i < pollListSize; i++)
        {
@@ -710,10 +735,13 @@ void Cluster::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *pol
        if (bModified)
                setModified();
        m_lastStatusPoll = time(NULL);
-       m_flags &= ~CLF_QUEUED_FOR_STATUS_POLL;
+       m_runtimeFlags &= ~DCDF_QUEUED_FOR_STATUS_POLL;
        unlockProperties();
 
+   sendPollerMsg(dwRqId, _T("CLUSTER STATUS POLL [%s]: Finished\r\n"), m_name);
        DbgPrintf(6, _T("CLUSTER STATUS POLL [%s]: Finished"), m_name);
+
+   pollerUnlock();
 }
 
 /**
index 0f6bdf2..939ab15 100644 (file)
@@ -341,7 +341,7 @@ int ProcessConsoleCommand(const TCHAR *pszCmdLine, CONSOLE_CTX pCtx)
             ExtractWord(pArg, szBuffer);
             UINT32 id = _tcstoul(szBuffer, NULL, 0);
             if (id != 0)
-            {
+            { //TODO: Implement pool for cluster and node + instance?
                Node *node = (Node *)FindObjectById(id, OBJECT_NODE);
                if (node != NULL)
                {
@@ -349,11 +349,11 @@ int ProcessConsoleCommand(const TCHAR *pszCmdLine, CONSOLE_CTX pCtx)
                   {
                      case 1:
                         node->lockForConfigurationPoll();
-                        ThreadPoolExecute(g_pollerThreadPool, node, &Node::configurationPoll, RegisterPoller(POLLER_TYPE_CONFIGURATION, node));
+                        ThreadPoolExecute(g_pollerThreadPool, node, &DataCollectionTarget::configurationPoll, RegisterPoller(POLLER_TYPE_CONFIGURATION, node));
                         break;
                      case 2:
                         node->lockForStatusPoll();
-                        ThreadPoolExecute(g_pollerThreadPool, node, &Node::statusPoll, RegisterPoller(POLLER_TYPE_STATUS, node));
+                        ThreadPoolExecute(g_pollerThreadPool, node, &DataCollectionTarget::statusPoll, RegisterPoller(POLLER_TYPE_STATUS, node));
                         break;
                      case 3:
                         node->lockForTopologyPoll();
index ab0719c..b3aee22 100644 (file)
@@ -74,7 +74,7 @@ bool Container::loadFromDatabase(DB_HANDLE hdb, UINT32 dwId)
    if (!loadCommonProperties(hdb))
       return false;
 
-   _sntprintf(szQuery, sizeof(szQuery) / sizeof(TCHAR), _T("SELECT flags,auto_bind_filter FROM object_containers WHERE id=%d"), dwId);
+   _sntprintf(szQuery, sizeof(szQuery) / sizeof(TCHAR), _T("SELECT auto_bind_filter FROM object_containers WHERE id=%d"), dwId);
    hResult = DBSelect(hdb, szQuery);
    if (hResult == NULL)
       return false;     // Query failed
@@ -86,8 +86,7 @@ bool Container::loadFromDatabase(DB_HANDLE hdb, UINT32 dwId)
       return false;
    }
 
-       m_flags = DBGetFieldULong(hResult, 0, 0);
-   m_bindFilterSource = DBGetField(hResult, 0, 1, NULL, 0);
+   m_bindFilterSource = DBGetField(hResult, 0, 0, NULL, 0);
    if (m_bindFilterSource != NULL)
    {
       TCHAR error[256];
@@ -141,11 +140,11 @@ BOOL Container::saveToDatabase(DB_HANDLE hdb)
        DB_STATEMENT hStmt;
    if (IsDatabaseRecordExist(hdb, _T("object_containers"), _T("id"), m_id))
        {
-               hStmt = DBPrepare(hdb, _T("UPDATE object_containers SET object_class=?,flags=?,auto_bind_filter=? WHERE id=?"));
+               hStmt = DBPrepare(hdb, _T("UPDATE object_containers SET object_class=?,auto_bind_filter=? WHERE id=?"));
        }
    else
        {
-               hStmt = DBPrepare(hdb, _T("INSERT INTO object_containers (object_class,flags,auto_bind_filter,id) VALUES (?,?,?,?)"));
+               hStmt = DBPrepare(hdb, _T("INSERT INTO object_containers (object_class,auto_bind_filter,id) VALUES (?,?,?)"));
        }
        if (hStmt == NULL)
        {
@@ -154,9 +153,8 @@ BOOL Container::saveToDatabase(DB_HANDLE hdb)
        }
 
        DBBind(hStmt, 1, DB_SQLTYPE_INTEGER, (LONG)getObjectClass());
-       DBBind(hStmt, 2, DB_SQLTYPE_INTEGER, m_flags);
-       DBBind(hStmt, 3, DB_SQLTYPE_TEXT, m_bindFilterSource, DB_BIND_STATIC);
-       DBBind(hStmt, 4, DB_SQLTYPE_INTEGER, m_id);
+       DBBind(hStmt, 2, DB_SQLTYPE_TEXT, m_bindFilterSource, DB_BIND_STATIC);
+       DBBind(hStmt, 3, DB_SQLTYPE_INTEGER, m_id);
        BOOL success = DBExecute(hStmt);
        DBFreeStatement(hStmt);
 
@@ -247,7 +245,6 @@ void Container::calculateCompoundStatus(BOOL bForcedRecalc)
 void Container::fillMessageInternal(NXCPMessage *msg)
 {
    NetObj::fillMessageInternal(msg);
-       msg->setField(VID_FLAGS, m_flags);
        msg->setField(VID_AUTOBIND_FILTER, CHECK_NULL_EX(m_bindFilterSource));
 }
 
index 1d5ae33..93e77eb 100644 (file)
@@ -49,7 +49,7 @@ static bool CheckNodeDown(Node *currNode, Event *pEvent, UINT32 nodeId, const TC
 static bool CheckAgentDown(Node *currNode, Event *pEvent, UINT32 nodeId, const TCHAR *nodeType)
 {
        Node *node = (Node *)FindObjectById(nodeId, OBJECT_NODE);
-       if ((node != NULL) && node->isNativeAgent() && (node->getRuntimeFlags() & NDF_AGENT_UNREACHABLE))
+       if ((node != NULL) && node->isNativeAgent() && (node->getState() & NSF_AGENT_UNREACHABLE))
        {
                pEvent->setRootId(node->getLastEventId(LAST_EVENT_AGENT_DOWN));
                DbgPrintf(5, _T("C_SysNodeDown: agent on %s %s [%d] for current node %s [%d] is down"),
@@ -243,14 +243,14 @@ void CorrelateEvent(Event *pEvent)
          // there are intentionally no break
       case EVENT_SERVICE_DOWN:
       case EVENT_SNMP_FAIL:
-         if (node->getRuntimeFlags() & NDF_UNREACHABLE)
+         if (node->getState() & NSF_UNREACHABLE)
          {
             pEvent->setRootId(node->getLastEventId(LAST_EVENT_NODE_DOWN));
          }
          break;
       case EVENT_AGENT_FAIL:
          node->setLastEventId(LAST_EVENT_AGENT_DOWN, pEvent->getId());
-         if (node->getRuntimeFlags() & NDF_UNREACHABLE)
+         if (node->getState() & NSF_UNREACHABLE)
          {
             pEvent->setRootId(node->getLastEventId(LAST_EVENT_NODE_DOWN));
          }
index 3e63cb2..b7307f8 100644 (file)
@@ -187,7 +187,6 @@ void Dashboard::fillMessageInternal(NXCPMessage *msg)
        Container::fillMessageInternal(msg);
 
        msg->setField(VID_NUM_COLUMNS, (WORD)m_numColumns);
-       msg->setField(VID_FLAGS, m_options);
        msg->setField(VID_NUM_ELEMENTS, (UINT32)m_elements->size());
 
        UINT32 varId = VID_ELEMENT_LIST_BASE;
@@ -210,7 +209,7 @@ UINT32 Dashboard::modifyFromMessageInternal(NXCPMessage *request)
                m_numColumns = (int)request->getFieldAsUInt16(VID_NUM_COLUMNS);
 
        if (request->isFieldExist(VID_FLAGS))
-               m_options = (int)request->getFieldAsUInt32(VID_FLAGS);
+          m_options = (int)request->getFieldAsUInt32(VID_FLAGS);
 
        if (request->isFieldExist(VID_NUM_ELEMENTS))
        {
index 5d4f41f..389cf1f 100644 (file)
@@ -29,6 +29,10 @@ DataCollectionTarget::DataCollectionTarget() : Template()
 {
    m_pingLastTimeStamp = 0;
    m_pingTime = PING_TIME_TIMEOUT;
+   m_lastConfigurationPoll = 0;
+   m_lastStatusPoll = 0;
+   m_lastInstancePoll = 0;
+   m_hPollerMutex = MutexCreate();
 }
 
 /**
@@ -38,6 +42,10 @@ DataCollectionTarget::DataCollectionTarget(const TCHAR *name) : Template(name)
 {
    m_pingLastTimeStamp = 0;
    m_pingTime = PING_TIME_TIMEOUT;
+   m_lastConfigurationPoll = 0;
+   m_lastStatusPoll = 0;
+   m_lastInstancePoll = 0;
+   m_hPollerMutex = MutexCreate();
 }
 
 /**
@@ -45,8 +53,12 @@ DataCollectionTarget::DataCollectionTarget(const TCHAR *name) : Template(name)
  */
 DataCollectionTarget::~DataCollectionTarget()
 {
+   MutexDestroy(m_hPollerMutex);
    m_pingLastTimeStamp = 0;
    m_pingTime = PING_TIME_TIMEOUT;
+   m_lastConfigurationPoll = 0;
+   m_lastStatusPoll = 0;
+   m_lastInstancePoll = 0;
 }
 
 /**
@@ -1279,3 +1291,265 @@ json_t *DataCollectionTarget::toJson()
    json_object_set_new(root, "pingLastTimeStamp", json_integer(m_pingLastTimeStamp));
    return root;
 }
+
+
+void DataCollectionTarget::statusPoll(PollerInfo *poller)
+{
+   poller->startExecution();
+   statusPoll(NULL, 0, poller);
+
+   delete poller;
+}
+
+void DataCollectionTarget::configurationPoll(PollerInfo *poller)
+{
+   poller->startExecution();
+   ObjectTransactionStart();
+   configurationPoll(NULL, 0, poller);
+   ObjectTransactionEnd();
+   delete poller;
+}
+
+void DataCollectionTarget::instanceDiscoveryPoll(PollerInfo *poller)
+{
+   poller->startExecution();
+   ObjectTransactionStart();
+   instanceDiscoveryPoll(NULL, 0, poller);
+   ObjectTransactionEnd();
+   delete poller;
+}
+
+/**
+ * Perform instance discovery poll on DataCollectionTarget
+ */
+void DataCollectionTarget::instanceDiscoveryPoll(ClientSession *session, UINT32 requestId, PollerInfo *poller)
+{
+   if (m_runtimeFlags & DCDF_DELETE_IN_PROGRESS)
+   {
+      if (requestId == 0)
+         m_runtimeFlags &= ~DCDF_QUEUED_FOR_INSTANCE_POLL;
+      return;
+   }
+
+   if (IsShutdownInProgress())
+      return;
+
+   poller->setStatus(_T("wait for lock"));
+   pollerLock();
+
+   if (IsShutdownInProgress())
+   {
+      pollerUnlock();
+      return;
+   }
+
+   m_pollRequestor = session;
+   sendPollerMsg(requestId, _T("Starting instance discovery poll for %s %s\r\n"), getObjectClassName(), m_name);
+   DbgPrintf(4, _T("Starting instance discovery poll for %s %s (ID: %d)"), getObjectClassName(), m_name, m_id);
+
+   // Check if DataCollectionTarget is marked as unreachable
+   if (!(m_state & NSF_UNREACHABLE))
+   {
+      poller->setStatus(_T("instance discovery"));
+      doInstanceDiscovery(requestId);
+
+      // Execute hook script
+      poller->setStatus(_T("hook"));
+      executeHookScript(_T("InstancePoll"));
+   }
+   else
+   {
+      sendPollerMsg(requestId, POLLER_WARNING _T("%s is marked as unreachable, instance discovery poll aborted\r\n"), getObjectClassName());
+      DbgPrintf(4, _T("%s is marked as unreachable, instance discovery poll aborted"), getObjectClassName());
+   }
+
+   m_lastInstancePoll = time(NULL);
+
+   // Finish instance discovery poll
+   poller->setStatus(_T("cleanup"));
+   if (requestId == 0)
+      m_runtimeFlags &= ~DCDF_QUEUED_FOR_INSTANCE_POLL;
+   pollerUnlock();
+   DbgPrintf(4, _T("Finished instance discovery poll for %s %s (ID: %d)"), getObjectClassName(), m_name, m_id);
+}
+
+/**
+ * Do instance discovery
+ */
+void DataCollectionTarget::doInstanceDiscovery(UINT32 requestId)
+{
+   sendPollerMsg(requestId, _T("Running DCI instance discovery\r\n"));
+
+   // collect instance discovery DCIs
+   ObjectArray<DCObject> rootObjects;
+   lockDciAccess(false);
+   for(int i = 0; i < m_dcObjects->size(); i++)
+   {
+      DCObject *object = m_dcObjects->get(i);
+      if (object->getInstanceDiscoveryMethod() != IDM_NONE)
+      {
+         object->setBusyFlag();
+         rootObjects.add(object);
+      }
+   }
+   unlockDciAccess();
+
+   // process instance discovery DCIs
+   // it should be done that way to prevent DCI list lock for long time
+   bool changed = false;
+   for(int i = 0; i < rootObjects.size(); i++)
+   {
+      DCObject *object = rootObjects.get(i);
+      DbgPrintf(5, _T("DataCollectionTarget::doInstanceDiscovery(%s [%u]): Updating instances for instance discovery DCO %s [%d]"),
+                m_name, m_id, object->getName(), object->getId());
+      sendPollerMsg(requestId, _T("   Updating instances for %s [%d]\r\n"), object->getName(), object->getId());
+      StringMap *instances = getInstanceList(object);
+      if (instances != NULL)
+      {
+         DbgPrintf(5, _T("DataCollectionTarget::doInstanceDiscovery(%s [%u]): read %d values"), m_name, m_id, instances->size());
+         object->filterInstanceList(instances);
+         if (updateInstances(object, instances, requestId))
+            changed = true;
+         delete instances;
+      }
+      else
+      {
+         DbgPrintf(5, _T("DataCollectionTarget::doInstanceDiscovery(%s [%u]): failed to get instance list for DCO %s [%d]"),
+                   m_name, m_id, object->getName(), object->getId());
+         sendPollerMsg(requestId, POLLER_ERROR _T("      Failed to get instance list\r\n"));
+      }
+      object->clearBusyFlag();
+   }
+
+   if (changed)
+      onDataCollectionChange();
+}
+
+/**
+ * Callback for finding instance
+ */
+static EnumerationCallbackResult FindInstanceCallback(const TCHAR *key, const void *value, void *data)
+{
+   return !_tcscmp((const TCHAR *)data, key) ? _STOP : _CONTINUE;
+}
+
+/**
+ * Data for CreateInstanceDCI
+ */
+struct CreateInstanceDCOData
+{
+   DCObject *root;
+   DataCollectionTarget *object;
+   UINT32 requestId;
+};
+
+/**
+ * Callback for creating instance DCIs
+ */
+static EnumerationCallbackResult CreateInstanceDCI(const TCHAR *key, const void *value, void *data)
+{
+   DataCollectionTarget *object = ((CreateInstanceDCOData *)data)->object;
+   DCObject *root = ((CreateInstanceDCOData *)data)->root;
+
+   DbgPrintf(5, _T("DataCollectionTarget::updateInstances(%s [%u], %s [%u]): creating new DCO for instance \"%s\""),
+             object->getName(), object->getId(), root->getName(), root->getId(), key);
+   object->sendPollerMsg(((CreateInstanceDCOData *)data)->requestId, _T("      Creating new DCO for instance \"%s\"\r\n"), key);
+
+   DCObject *dco = root->clone();
+
+   dco->setTemplateId(object->getId(), root->getId());
+   dco->setInstance((const TCHAR *)value);
+   dco->setInstanceDiscoveryMethod(IDM_NONE);
+   dco->setInstanceDiscoveryData(key);
+   dco->setInstanceFilter(NULL);
+   dco->expandInstance();
+   dco->changeBinding(CreateUniqueId(IDG_ITEM), object, FALSE);
+   object->addDCObject(dco, true);
+   return _CONTINUE;
+}
+
+/**
+ * Update instance DCIs created from instance discovery DCI
+ */
+bool DataCollectionTarget::updateInstances(DCObject *root, StringMap *instances, UINT32 requestId)
+{
+   bool changed = false;
+
+   lockDciAccess(true);
+
+   // Delete DCIs for missing instances and update existing
+   IntegerArray<UINT32> deleteList;
+   for(int i = 0; i < m_dcObjects->size(); i++)
+   {
+      DCObject *object = m_dcObjects->get(i);
+      if ((object->getTemplateId() != m_id) || (object->getTemplateItemId() != root->getId()))
+         continue;
+
+      const TCHAR *dcoInstance = object->getInstanceDiscoveryData();
+      if (instances->forEach(FindInstanceCallback, (void *)dcoInstance) == _STOP)
+      {
+         // found, remove value from instances
+         DbgPrintf(5, _T("DataCollectionTarget::updateInstances(%s [%u], %s [%u]): instance \"%s\" found"),
+                   m_name, m_id, root->getName(), root->getId(), dcoInstance);
+         const TCHAR *name = instances->get(dcoInstance);
+         if (_tcscmp(name, object->getInstance()))
+         {
+            object->setInstance(name);
+            object->updateFromTemplate(root);
+            changed = true;
+         }
+         instances->remove(dcoInstance);
+      }
+      else
+      {
+         // not found, delete DCO
+         DbgPrintf(5, _T("DataCollectionTarget::updateInstances(%s [%u], %s [%u]): instance \"%s\" not found, instance DCO will be deleted"),
+                   m_name, m_id, root->getName(), root->getId(), dcoInstance);
+         sendPollerMsg(requestId, _T("      Existing instance \"%s\" not found and will be deleted\r\n"), dcoInstance);
+         deleteList.add(object->getId());
+         changed = true;
+      }
+   }
+
+   for(int i = 0; i < deleteList.size(); i++)
+      deleteDCObject(deleteList.get(i), false);
+
+   // Create new instances
+   if (instances->size() > 0)
+   {
+      CreateInstanceDCOData data;
+      data.root = root;
+      data.object = this;
+      data.requestId = requestId;
+      instances->forEach(CreateInstanceDCI, &data);
+      changed = true;
+   }
+
+   unlockDciAccess();
+   return changed;
+}
+
+/**
+ * Execute hook script
+ *
+ * @param hookName hook name. Will find and excute script named Hook::hookName
+ */
+void DataCollectionTarget::executeHookScript(const TCHAR *hookName)
+{
+   TCHAR scriptName[MAX_PATH] = _T("Hook::");
+   nx_strncpy(&scriptName[6], hookName, MAX_PATH - 6);
+   NXSL_VM *vm = CreateServerScriptVM(scriptName);
+   if (vm == NULL)
+   {
+      DbgPrintf(7, _T("DataCollectionTarget::executeHookScript(%s [%u]): hook script \"%s\" not found"), m_name, m_id, scriptName);
+      return;
+   }
+
+   vm->setGlobalVariable(_T("$object"), createNXSLObject());
+   if (!vm->run())
+   {
+      DbgPrintf(4, _T("DataCollectionTarget::executeHookScript(%s [%u]): hook script \"%s\" execution error: %s"),
+                m_name, m_id, scriptName, vm->getErrorText());
+   }
+   delete vm;
+}
index a9e4354..29e0a5e 100644 (file)
@@ -29,7 +29,6 @@
 Interface::Interface() : NetObj()
 {
    m_parentInterfaceId = 0;
-       m_flags = 0;
        nx_strncpy(m_description, m_name, MAX_DB_STRING);
    m_alias[0] = 0;
    m_index = 0;
@@ -186,7 +185,7 @@ bool Interface::loadFromDatabase(DB_HANDLE hdb, UINT32 dwId)
 
        DB_STATEMENT hStmt = DBPrepare(hdb,
                _T("SELECT if_type,if_index,node_id,")
-               _T("mac_addr,flags,required_polls,bridge_port,phy_slot,")
+               _T("mac_addr,required_polls,bridge_port,phy_slot,")
                _T("phy_port,peer_node_id,peer_if_id,description,")
                _T("dot1x_pae_state,dot1x_backend_state,admin_state,")
       _T("oper_state,peer_proto,alias,mtu,speed,parent_iface,")
@@ -208,27 +207,26 @@ bool Interface::loadFromDatabase(DB_HANDLE hdb, UINT32 dwId)
       m_index = DBGetFieldULong(hResult, 0, 1);
       UINT32 nodeId = DBGetFieldULong(hResult, 0, 2);
                DBGetFieldByteArray2(hResult, 0, 3, m_macAddr, MAC_ADDR_LENGTH, 0);
-               m_flags = DBGetFieldULong(hResult, 0, 4);
-      m_requiredPollCount = DBGetFieldLong(hResult, 0, 5);
-               m_bridgePortNumber = DBGetFieldULong(hResult, 0, 6);
-               m_slotNumber = DBGetFieldULong(hResult, 0, 7);
-               m_portNumber = DBGetFieldULong(hResult, 0, 8);
-               m_peerNodeId = DBGetFieldULong(hResult, 0, 9);
-               m_peerInterfaceId = DBGetFieldULong(hResult, 0, 10);
-               DBGetField(hResult, 0, 11, m_description, MAX_DB_STRING);
-               m_dot1xPaeAuthState = (WORD)DBGetFieldLong(hResult, 0, 12);
-               m_dot1xBackendAuthState = (WORD)DBGetFieldLong(hResult, 0, 13);
-               m_adminState = (WORD)DBGetFieldLong(hResult, 0, 14);
-               m_operState = (WORD)DBGetFieldLong(hResult, 0, 15);
+      m_requiredPollCount = DBGetFieldLong(hResult, 0, 4);
+               m_bridgePortNumber = DBGetFieldULong(hResult, 0, 5);
+               m_slotNumber = DBGetFieldULong(hResult, 0, 6);
+               m_portNumber = DBGetFieldULong(hResult, 0, 7);
+               m_peerNodeId = DBGetFieldULong(hResult, 0, 8);
+               m_peerInterfaceId = DBGetFieldULong(hResult, 0, 9);
+               DBGetField(hResult, 0, 10, m_description, MAX_DB_STRING);
+               m_dot1xPaeAuthState = (WORD)DBGetFieldLong(hResult, 0, 11);
+               m_dot1xBackendAuthState = (WORD)DBGetFieldLong(hResult, 0, 12);
+               m_adminState = (WORD)DBGetFieldLong(hResult, 0, 13);
+               m_operState = (WORD)DBGetFieldLong(hResult, 0, 14);
                m_confirmedOperState = m_operState;
-               m_peerDiscoveryProtocol = (LinkLayerProtocol)DBGetFieldLong(hResult, 0, 16);
-               DBGetField(hResult, 0, 17, m_alias, MAX_DB_STRING);
-               m_mtu = DBGetFieldULong(hResult, 0, 18);
-      m_speed = DBGetFieldUInt64(hResult, 0, 19);
-      m_parentInterfaceId = DBGetFieldULong(hResult, 0, 20);
+               m_peerDiscoveryProtocol = (LinkLayerProtocol)DBGetFieldLong(hResult, 0, 15);
+               DBGetField(hResult, 0, 16, m_alias, MAX_DB_STRING);
+               m_mtu = DBGetFieldULong(hResult, 0, 17);
+      m_speed = DBGetFieldUInt64(hResult, 0, 18);
+      m_parentInterfaceId = DBGetFieldULong(hResult, 0, 19);
 
       TCHAR suffixText[128];
-      DBGetField(hResult, 0, 21, suffixText, 128);
+      DBGetField(hResult, 0, 20, suffixText, 128);
       StrStrip(suffixText);
       if (suffixText[0] == 0)
       {
@@ -348,7 +346,7 @@ BOOL Interface::saveToDatabase(DB_HANDLE hdb)
    if (IsDatabaseRecordExist(hdb, _T("interfaces"), _T("id"), m_id))
        {
                hStmt = DBPrepare(hdb,
-                       _T("UPDATE interfaces SET node_id=?,if_type=?,if_index=?,mac_addr=?,flags=?,")
+                       _T("UPDATE interfaces SET node_id=?,if_type=?,if_index=?,mac_addr=?,")
                        _T("required_polls=?,bridge_port=?,phy_slot=?,phy_port=?,")
                        _T("peer_node_id=?,peer_if_id=?,description=?,admin_state=?,")
                        _T("oper_state=?,dot1x_pae_state=?,dot1x_backend_state=?,")
@@ -359,10 +357,10 @@ BOOL Interface::saveToDatabase(DB_HANDLE hdb)
        {
                hStmt = DBPrepare(hdb,
                        _T("INSERT INTO interfaces (node_id,if_type,if_index,mac_addr,")
-                       _T("flags,required_polls,bridge_port,phy_slot,phy_port,peer_node_id,peer_if_id,description,")
+                       _T("required_polls,bridge_port,phy_slot,phy_port,peer_node_id,peer_if_id,description,")
          _T("admin_state,oper_state,dot1x_pae_state,dot1x_backend_state,peer_proto,alias,mtu,speed,")
          _T("parent_iface,iftable_suffix,id) ")
-                       _T("VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"));
+                       _T("VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"));
        }
        if (hStmt == NULL)
        {
@@ -374,33 +372,32 @@ BOOL Interface::saveToDatabase(DB_HANDLE hdb)
        DBBind(hStmt, 2, DB_SQLTYPE_INTEGER, m_type);
        DBBind(hStmt, 3, DB_SQLTYPE_INTEGER, m_index);
        DBBind(hStmt, 4, DB_SQLTYPE_VARCHAR, BinToStr(m_macAddr, MAC_ADDR_LENGTH, szMacStr), DB_BIND_STATIC);
-       DBBind(hStmt, 5, DB_SQLTYPE_INTEGER, m_flags);
-       DBBind(hStmt, 6, DB_SQLTYPE_INTEGER, (LONG)m_requiredPollCount);
-       DBBind(hStmt, 7, DB_SQLTYPE_INTEGER, m_bridgePortNumber);
-       DBBind(hStmt, 8, DB_SQLTYPE_INTEGER, m_slotNumber);
-       DBBind(hStmt, 9, DB_SQLTYPE_INTEGER, m_portNumber);
-       DBBind(hStmt, 10, DB_SQLTYPE_INTEGER, m_peerNodeId);
-       DBBind(hStmt, 11, DB_SQLTYPE_INTEGER, m_peerInterfaceId);
-       DBBind(hStmt, 12, DB_SQLTYPE_VARCHAR, m_description, DB_BIND_STATIC);
-       DBBind(hStmt, 13, DB_SQLTYPE_INTEGER, (UINT32)m_adminState);
-       DBBind(hStmt, 14, DB_SQLTYPE_INTEGER, (UINT32)m_operState);
-       DBBind(hStmt, 15, DB_SQLTYPE_INTEGER, (UINT32)m_dot1xPaeAuthState);
-       DBBind(hStmt, 16, DB_SQLTYPE_INTEGER, (UINT32)m_dot1xBackendAuthState);
-       DBBind(hStmt, 17, DB_SQLTYPE_INTEGER, (INT32)m_peerDiscoveryProtocol);
-       DBBind(hStmt, 18, DB_SQLTYPE_VARCHAR, m_alias, DB_BIND_STATIC);
-       DBBind(hStmt, 19, DB_SQLTYPE_INTEGER, m_mtu);
-       DBBind(hStmt, 20, DB_SQLTYPE_BIGINT, m_speed);
-   DBBind(hStmt, 21, DB_SQLTYPE_INTEGER, m_parentInterfaceId);
+       DBBind(hStmt, 5, DB_SQLTYPE_INTEGER, (LONG)m_requiredPollCount);
+       DBBind(hStmt, 6, DB_SQLTYPE_INTEGER, m_bridgePortNumber);
+       DBBind(hStmt, 7, DB_SQLTYPE_INTEGER, m_slotNumber);
+       DBBind(hStmt, 8, DB_SQLTYPE_INTEGER, m_portNumber);
+       DBBind(hStmt, 9, DB_SQLTYPE_INTEGER, m_peerNodeId);
+       DBBind(hStmt, 10, DB_SQLTYPE_INTEGER, m_peerInterfaceId);
+       DBBind(hStmt, 11, DB_SQLTYPE_VARCHAR, m_description, DB_BIND_STATIC);
+       DBBind(hStmt, 12, DB_SQLTYPE_INTEGER, (UINT32)m_adminState);
+       DBBind(hStmt, 13, DB_SQLTYPE_INTEGER, (UINT32)m_operState);
+       DBBind(hStmt, 14, DB_SQLTYPE_INTEGER, (UINT32)m_dot1xPaeAuthState);
+       DBBind(hStmt, 15, DB_SQLTYPE_INTEGER, (UINT32)m_dot1xBackendAuthState);
+       DBBind(hStmt, 16, DB_SQLTYPE_INTEGER, (INT32)m_peerDiscoveryProtocol);
+       DBBind(hStmt, 17, DB_SQLTYPE_VARCHAR, m_alias, DB_BIND_STATIC);
+       DBBind(hStmt, 18, DB_SQLTYPE_INTEGER, m_mtu);
+       DBBind(hStmt, 19, DB_SQLTYPE_BIGINT, m_speed);
+   DBBind(hStmt, 20, DB_SQLTYPE_INTEGER, m_parentInterfaceId);
    if (m_ifTableSuffixLen > 0)
    {
       TCHAR buffer[128];
-      DBBind(hStmt, 22, DB_SQLTYPE_VARCHAR, SNMPConvertOIDToText(m_ifTableSuffixLen, m_ifTableSuffix, buffer, 128), DB_BIND_TRANSIENT);
+      DBBind(hStmt, 21, DB_SQLTYPE_VARCHAR, SNMPConvertOIDToText(m_ifTableSuffixLen, m_ifTableSuffix, buffer, 128), DB_BIND_TRANSIENT);
    }
    else
    {
-          DBBind(hStmt, 22, DB_SQLTYPE_VARCHAR, NULL, DB_BIND_STATIC);
+          DBBind(hStmt, 21, DB_SQLTYPE_VARCHAR, NULL, DB_BIND_STATIC);
    }
-       DBBind(hStmt, 23, DB_SQLTYPE_INTEGER, m_id);
+       DBBind(hStmt, 22, DB_SQLTYPE_INTEGER, m_id);
 
        BOOL success = DBExecute(hStmt);
        DBFreeStatement(hStmt);
@@ -491,8 +488,8 @@ void Interface::statusPoll(ClientSession *session, UINT32 rqId, Queue *eventQueu
    BOOL bNeedPoll = TRUE;
 
    // Poll interface using different methods
-   if ((pNode->getFlags() & NF_IS_NATIVE_AGENT) &&
-       (!(pNode->getFlags() & NF_DISABLE_NXCP)) && (!(pNode->getRuntimeFlags() & NDF_AGENT_UNREACHABLE)))
+   if ((pNode->getCapabilities() & NC_IS_NATIVE_AGENT) &&
+       (!(pNode->getFlags() & NF_DISABLE_NXCP)) && (!(pNode->getState() & NSF_AGENT_UNREACHABLE)))
    {
       sendPollerMsg(rqId, _T("      Retrieving interface status from NetXMS agent\r\n"));
       pNode->getInterfaceStatusFromAgent(m_index, &adminState, &operState);
@@ -508,8 +505,8 @@ void Interface::statusPoll(ClientSession *session, UINT32 rqId, Queue *eventQueu
                }
    }
 
-   if (bNeedPoll && (pNode->getFlags() & NF_IS_SNMP) &&
-       (!(pNode->getFlags() & NF_DISABLE_SNMP)) && (!(pNode->getRuntimeFlags() & NDF_SNMP_UNREACHABLE)) &&
+   if (bNeedPoll && (pNode->getCapabilities() & NC_IS_SNMP) &&
+       (!(pNode->getFlags() & NF_DISABLE_SNMP)) && (!(pNode->getState() & NSF_SNMP_UNREACHABLE)) &&
                 (snmpTransport != NULL))
    {
       sendPollerMsg(rqId, _T("      Retrieving interface status from SNMP agent\r\n"));
@@ -601,7 +598,7 @@ void Interface::statusPoll(ClientSession *session, UINT32 rqId, Queue *eventQueu
        }
 
        // Check 802.1x state
-       if ((pNode->getFlags() & NF_IS_8021X) && isPhysicalPort() && (snmpTransport != NULL))
+       if ((pNode->getCapabilities() & NC_IS_8021X) && isPhysicalPort() && (snmpTransport != NULL))
        {
                DbgPrintf(5, _T("StatusPoll(%s): Checking 802.1x state for interface %s"), pNode->getName(), m_name);
                paeStatusPoll(rqId, snmpTransport, pNode);
@@ -610,7 +607,7 @@ void Interface::statusPoll(ClientSession *session, UINT32 rqId, Queue *eventQueu
        }
 
        // Reset status to unknown if node has known network connectivity problems
-       if ((newStatus == STATUS_CRITICAL) && (pNode->getRuntimeFlags() & NDF_NETWORK_PATH_PROBLEM))
+       if ((newStatus == STATUS_CRITICAL) && (pNode->getState() & NSF_NETWORK_PATH_PROBLEM))
        {
                newStatus = STATUS_UNKNOWN;
                DbgPrintf(6, _T("StatusPoll(%s): Status for interface %s reset to UNKNOWN"), pNode->getName(), m_name);
@@ -1022,7 +1019,6 @@ void Interface::fillMessageInternal(NXCPMessage *pMsg)
    pMsg->setField(VID_IF_SLOT, m_slotNumber);
    pMsg->setField(VID_IF_PORT, m_portNumber);
    pMsg->setField(VID_MAC_ADDR, m_macAddr, MAC_ADDR_LENGTH);
-       pMsg->setField(VID_FLAGS, m_flags);
        pMsg->setField(VID_REQUIRED_POLLS, (WORD)m_requiredPollCount);
        pMsg->setField(VID_PEER_NODE_ID, m_peerNodeId);
        pMsg->setField(VID_PEER_INTERFACE_ID, m_peerInterfaceId);
@@ -1043,6 +1039,14 @@ void Interface::fillMessageInternal(NXCPMessage *pMsg)
  */
 UINT32 Interface::modifyFromMessageInternal(NXCPMessage *pRequest)
 {
+   // Flags
+   if (pRequest->isFieldExist(VID_FLAGS))
+   {
+      UINT32 mask = pRequest->isFieldExist(VID_FLAGS_MASK) ? (pRequest->getFieldAsUInt32(VID_FLAGS_MASK) & IF_USER_FLAGS_MASK) : IF_USER_FLAGS_MASK;
+      m_flags &= ~mask;
+      m_flags |= pRequest->getFieldAsUInt32(VID_FLAGS) & mask;
+   }
+
    // Number of required polls
    if (pRequest->isFieldExist(VID_REQUIRED_POLLS))
       m_requiredPollCount = (int)pRequest->getFieldAsUInt16(VID_REQUIRED_POLLS);
@@ -1053,14 +1057,6 @@ UINT32 Interface::modifyFromMessageInternal(NXCPMessage *pRequest)
                setExpectedStateInternal(pRequest->getFieldAsInt16(VID_EXPECTED_STATE));
        }
 
-       // Flags
-       if (pRequest->isFieldExist(VID_FLAGS))
-       {
-      UINT32 mask = pRequest->isFieldExist(VID_FLAGS_MASK) ? (pRequest->getFieldAsUInt32(VID_FLAGS_MASK) & IF_USER_FLAGS_MASK) : IF_USER_FLAGS_MASK;
-               m_flags &= ~mask;
-               m_flags |= pRequest->getFieldAsUInt32(VID_FLAGS) & mask;
-       }
-
    return NetObj::modifyFromMessageInternal(pRequest);
 }
 
index 383fc0e..a157cd1 100644 (file)
@@ -284,7 +284,7 @@ static UINT32 LLDPTopoHandler(SNMP_Variable *var, SNMP_Transport *transport, voi
  */
 void AddLLDPNeighbors(Node *node, LinkLayerNeighbors *nbs)
 {
-       if (!(node->getFlags() & NF_IS_LLDP))
+       if (!(node->getCapabilities() & NC_IS_LLDP))
                return;
 
        DbgPrintf(5, _T("LLDP: collecting topology information for node %s [%d]"), node->getName(), node->getId());
index 8952e9a..bf7db06 100644 (file)
@@ -90,15 +90,15 @@ LinkLayerNeighbors *BuildLinkLayerNeighborList(Node *node)
 {
        LinkLayerNeighbors *nbs = new LinkLayerNeighbors();
 
-       if (node->getFlags() & NF_IS_LLDP)
+       if (node->getCapabilities() & NC_IS_LLDP)
        {
                AddLLDPNeighbors(node, nbs);
        }
-       if (node->getFlags() & NF_IS_CDP)
+       if (node->getCapabilities() & NC_IS_CDP)
        {
                AddCDPNeighbors(node, nbs);
        }
-       if (node->getFlags() & NF_IS_NDP)
+       if (node->getCapabilities() & NC_IS_NDP)
        {
                AddNDPNeighbors(node, nbs);
        }
index 9c5a138..2514132 100644 (file)
@@ -113,7 +113,7 @@ static UINT32 NDPTopoHandler(SNMP_Variable *var, SNMP_Transport *transport, void
  */
 void AddNDPNeighbors(Node *node, LinkLayerNeighbors *nbs)
 {
-       if (!(node->getFlags() & NF_IS_NDP))
+       if (!(node->getCapabilities() & NC_IS_NDP))
                return;
 
        DbgPrintf(5, _T("NDP: collecting topology information for node %s [%d]"), node->getName(), node->getId());
index 38d026c..5515bef 100644 (file)
@@ -245,11 +245,11 @@ BOOL NetworkMap::saveToDatabase(DB_HANDLE hdb)
        DB_STATEMENT hStmt;
        if (IsDatabaseRecordExist(hdb, _T("network_maps"), _T("id"), m_id))
        {
-               hStmt = DBPrepare(hdb, _T("UPDATE network_maps SET map_type=?,layout=?,radius=?,background=?,bg_latitude=?,bg_longitude=?,bg_zoom=?,flags=?,link_color=?,link_routing=?,bg_color=?,object_display_mode=?,filter=? WHERE id=?"));
+               hStmt = DBPrepare(hdb, _T("UPDATE network_maps SET map_type=?,layout=?,radius=?,background=?,bg_latitude=?,bg_longitude=?,bg_zoom=?,link_color=?,link_routing=?,bg_color=?,object_display_mode=?,filter=? WHERE id=?"));
        }
        else
        {
-               hStmt = DBPrepare(hdb, _T("INSERT INTO network_maps (map_type,layout,radius,background,bg_latitude,bg_longitude,bg_zoom,flags,link_color,link_routing,bg_color,object_display_mode,filter,id) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)"));
+               hStmt = DBPrepare(hdb, _T("INSERT INTO network_maps (map_type,layout,radius,background,bg_latitude,bg_longitude,bg_zoom,link_color,link_routing,bg_color,object_display_mode,filter,id) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"));
        }
        if (hStmt == NULL)
                goto fail;
@@ -261,13 +261,12 @@ BOOL NetworkMap::saveToDatabase(DB_HANDLE hdb)
        DBBind(hStmt, 5, DB_SQLTYPE_DOUBLE, m_backgroundLatitude);
        DBBind(hStmt, 6, DB_SQLTYPE_DOUBLE, m_backgroundLongitude);
        DBBind(hStmt, 7, DB_SQLTYPE_INTEGER, (INT32)m_backgroundZoom);
-       DBBind(hStmt, 8, DB_SQLTYPE_INTEGER, m_flags);
-       DBBind(hStmt, 9, DB_SQLTYPE_INTEGER, (INT32)m_defaultLinkColor);
-       DBBind(hStmt, 10, DB_SQLTYPE_INTEGER, (INT32)m_defaultLinkRouting);
-       DBBind(hStmt, 11, DB_SQLTYPE_INTEGER, (INT32)m_backgroundColor);
-       DBBind(hStmt, 12, DB_SQLTYPE_INTEGER, (INT32)m_objectDisplayMode);
-       DBBind(hStmt, 13, DB_SQLTYPE_VARCHAR, m_filterSource, DB_BIND_STATIC);
-       DBBind(hStmt, 14, DB_SQLTYPE_INTEGER, m_id);
+       DBBind(hStmt, 8, DB_SQLTYPE_INTEGER, (INT32)m_defaultLinkColor);
+       DBBind(hStmt, 9, DB_SQLTYPE_INTEGER, (INT32)m_defaultLinkRouting);
+       DBBind(hStmt, 10, DB_SQLTYPE_INTEGER, (INT32)m_backgroundColor);
+       DBBind(hStmt, 11, DB_SQLTYPE_INTEGER, (INT32)m_objectDisplayMode);
+       DBBind(hStmt, 12, DB_SQLTYPE_VARCHAR, m_filterSource, DB_BIND_STATIC);
+       DBBind(hStmt, 13, DB_SQLTYPE_INTEGER, m_id);
 
        if (!DBExecute(hStmt))
        {
@@ -386,7 +385,7 @@ bool NetworkMap::loadFromDatabase(DB_HANDLE hdb, UINT32 dwId)
 
           loadACLFromDB(hdb);
 
-               _sntprintf(query, 256, _T("SELECT map_type,layout,radius,background,bg_latitude,bg_longitude,bg_zoom,flags,link_color,link_routing,bg_color,object_display_mode,filter FROM network_maps WHERE id=%d"), dwId);
+               _sntprintf(query, 256, _T("SELECT map_type,layout,radius,background,bg_latitude,bg_longitude,bg_zoom,link_color,link_routing,bg_color,object_display_mode,filter FROM network_maps WHERE id=%d"), dwId);
                DB_RESULT hResult = DBSelect(hdb, query);
                if (hResult == NULL)
                        return false;
@@ -518,7 +517,6 @@ void NetworkMap::fillMessageInternal(NXCPMessage *msg)
 
        msg->setField(VID_MAP_TYPE, (WORD)m_mapType);
        msg->setField(VID_LAYOUT, (WORD)m_layout);
-       msg->setField(VID_FLAGS, m_flags);
        msg->setFieldFromInt32Array(VID_SEED_OBJECTS, m_seedObjects);
        msg->setField(VID_DISCOVERY_RADIUS, (UINT32)m_discoveryRadius);
        msg->setField(VID_BACKGROUND, m_background);
index 6fa927a..bd81733 100644 (file)
@@ -85,6 +85,9 @@ NetObj::NetObj()
    m_postalAddress = new PostalAddress();
    m_dashboards = new IntegerArray<UINT32>();
    m_urls = new ObjectArray<ObjectUrl>(4, 4, true);
+   m_state = 0;
+   m_runtimeFlags = 0;
+   m_flags = 0;
 }
 
 /**
@@ -226,7 +229,7 @@ bool NetObj::loadCommonProperties(DB_HANDLE hdb)
                              _T("status_thresholds,comments,is_system,")
                                                                          _T("location_type,latitude,longitude,location_accuracy,")
                                                                          _T("location_timestamp,guid,image,submap_id,country,city,")
-                             _T("street_address,postcode,maint_mode,maint_event_id FROM object_properties ")
+                             _T("street_address,postcode,maint_mode,maint_event_id,state,flags FROM object_properties ")
                              _T("WHERE object_id=?"));
        if (hStmt != NULL)
        {
@@ -281,6 +284,10 @@ bool NetObj::loadCommonProperties(DB_HANDLE hdb)
             m_maintenanceMode = DBGetFieldLong(hResult, 0, 26) ? true : false;
             m_maintenanceEventId = DBGetFieldUInt64(hResult, 0, 27);
 
+            m_state = DBGetFieldULong(hResult, 0, 28);
+            m_runtimeFlags = 0;
+            m_flags = DBGetFieldULong(hResult, 0, 29);
+
                                success = true;
                        }
                        DBFreeResult(hResult);
@@ -431,7 +438,7 @@ bool NetObj::saveCommonProperties(DB_HANDLE hdb)
                     _T("comments=?,is_system=?,location_type=?,latitude=?,")
                                                  _T("longitude=?,location_accuracy=?,location_timestamp=?,")
                                                  _T("guid=?,image=?,submap_id=?,country=?,city=?,")
-                    _T("street_address=?,postcode=?,maint_mode=?,maint_event_id=? WHERE object_id=?"));
+                    _T("street_address=?,postcode=?,maint_mode=?,maint_event_id=?,state=?,flags=? WHERE object_id=?"));
        }
        else
        {
@@ -442,8 +449,8 @@ bool NetObj::saveCommonProperties(DB_HANDLE hdb)
                     _T("status_single_threshold,status_thresholds,comments,is_system,")
                                                  _T("location_type,latitude,longitude,location_accuracy,location_timestamp,")
                                                  _T("guid,image,submap_id,country,city,street_address,postcode,maint_mode,")
-                                                 _T("maint_event_id,object_id) ")
-                    _T("VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"));
+                                                 _T("maint_event_id,state,flags,object_id) ")
+                    _T("VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"));
        }
        if (hStmt == NULL)
                return false;
@@ -485,7 +492,9 @@ bool NetObj::saveCommonProperties(DB_HANDLE hdb)
        DBBind(hStmt, 26, DB_SQLTYPE_VARCHAR, m_postalAddress->getPostCode(), DB_BIND_STATIC);
    DBBind(hStmt, 27, DB_SQLTYPE_VARCHAR, m_maintenanceMode ? _T("1") : _T("0"), DB_BIND_STATIC);
    DBBind(hStmt, 28, DB_SQLTYPE_BIGINT, m_maintenanceEventId);
-       DBBind(hStmt, 29, DB_SQLTYPE_INTEGER, m_id);
+       DBBind(hStmt, 29, DB_SQLTYPE_INTEGER, m_state);
+       DBBind(hStmt, 30, DB_SQLTYPE_INTEGER, m_flags);
+       DBBind(hStmt, 31, DB_SQLTYPE_INTEGER, m_id);
 
    bool success = DBExecute(hStmt);
        DBFreeStatement(hStmt);
@@ -1065,6 +1074,7 @@ void NetObj::fillMessageInternal(NXCPMessage *pMsg)
    pMsg->setField(VID_IS_DELETED, (WORD)(m_isDeleted ? 1 : 0));
    pMsg->setField(VID_IS_SYSTEM, (INT16)(m_isSystem ? 1 : 0));
    pMsg->setField(VID_MAINTENANCE_MODE, (INT16)(m_maintenanceEventId ? 1 : 0));
+   pMsg->setField(VID_FLAGS, m_flags);
 
    pMsg->setField(VID_INHERIT_RIGHTS, m_inheritAccessRights);
    pMsg->setField(VID_STATUS_CALCULATION_ALG, (WORD)m_statusCalcAlg);
index e002b4d..886d3e3 100644 (file)
@@ -380,7 +380,7 @@ void NetworkService::statusPoll(ClientSession *session, UINT32 rqId, Node *polle
    }
 
        // Reset status to unknown if node has known network connectivity problems
-       if ((newStatus == STATUS_CRITICAL) && (pNode->getRuntimeFlags() & NDF_NETWORK_PATH_PROBLEM))
+       if ((newStatus == STATUS_CRITICAL) && (pNode->getState() & NSF_NETWORK_PATH_PROBLEM))
        {
                newStatus = STATUS_UNKNOWN;
                DbgPrintf(6, _T("StatusPoll(%s): Status for network service %s reset to UNKNOWN"), pNode->getName(), m_name);
index 0b87622..b7a79c9 100644 (file)
@@ -38,7 +38,7 @@ Node::Node() : DataCollectionTarget()
    m_status = STATUS_UNKNOWN;
    m_type = NODE_TYPE_UNKNOWN;
    m_subType[0] = 0;
-   m_dwDynamicFlags = 0;
+   m_capabilities = 0;
    m_zoneUIN = 0;
    m_agentPort = AGENT_LISTEN_PORT;
    m_agentAuthMethod = AUTH_NONE;
@@ -58,7 +58,6 @@ Node::Node() : DataCollectionTarget()
    m_downSince = 0;
    m_bootTime = 0;
    m_agentUpTime = 0;
-   m_hPollerMutex = MutexCreate();
    m_hAgentAccessMutex = MutexCreate();
    m_hSmclpAccessMutex = MutexCreate();
    m_mutexRTAccess = MutexCreate();
@@ -129,15 +128,15 @@ Node::Node() : DataCollectionTarget()
 /**
  * Constructor for new node object
  */
-Node::Node(const InetAddress& addr, UINT32 dwFlags, UINT32 agentProxy, UINT32 snmpProxy, UINT32 icmpProxy, UINT32 sshProxy, UINT32 zoneUIN) : DataCollectionTarget()
+Node::Node(const InetAddress& addr, UINT32 flags, UINT32 capabilities, UINT32 agentProxy, UINT32 snmpProxy, UINT32 icmpProxy, UINT32 sshProxy, UINT32 zoneUIN) : DataCollectionTarget()
 {
    addr.toString(m_primaryName);
    m_status = STATUS_UNKNOWN;
    m_type = NODE_TYPE_UNKNOWN;
    m_subType[0] = 0;
    m_ipAddress = addr;
-   m_flags = dwFlags;
-   m_dwDynamicFlags = 0;
+   m_capabilities = capabilities;
+   m_flags = flags;
    m_zoneUIN = zoneUIN;
    m_agentPort = AGENT_LISTEN_PORT;
    m_agentAuthMethod = AUTH_NONE;
@@ -158,7 +157,6 @@ Node::Node(const InetAddress& addr, UINT32 dwFlags, UINT32 agentProxy, UINT32 sn
    m_downSince = 0;
    m_bootTime = 0;
    m_agentUpTime = 0;
-   m_hPollerMutex = MutexCreate();
    m_hAgentAccessMutex = MutexCreate();
    m_hSmclpAccessMutex = MutexCreate();
    m_mutexRTAccess = MutexCreate();
@@ -233,7 +231,6 @@ Node::Node(const InetAddress& addr, UINT32 dwFlags, UINT32 agentProxy, UINT32 sn
 Node::~Node()
 {
    delete m_driverData;
-   MutexDestroy(m_hPollerMutex);
    MutexDestroy(m_hAgentAccessMutex);
    MutexDestroy(m_hSmclpAccessMutex);
    MutexDestroy(m_mutexRTAccess);
@@ -290,14 +287,14 @@ bool Node::loadFromDatabase(DB_HANDLE hdb, UINT32 dwId)
    }
 
    DB_STATEMENT hStmt = DBPrepare(hdb,
-      _T("SELECT primary_name,primary_ip,node_flags,")
+      _T("SELECT primary_name,primary_ip,")
       _T("snmp_version,auth_method,secret,")
       _T("agent_port,status_poll_type,snmp_oid,agent_version,")
       _T("platform_name,poller_node_id,zone_guid,")
       _T("proxy_node,snmp_proxy,required_polls,uname,")
       _T("use_ifxtable,snmp_port,community,usm_auth_password,")
       _T("usm_priv_password,usm_methods,snmp_sys_name,bridge_base_addr,")
-      _T("runtime_flags,down_since,boot_time,driver_name,icmp_proxy,")
+      _T("down_since,boot_time,driver_name,icmp_proxy,")
       _T("agent_cache_mode,snmp_sys_contact,snmp_sys_location,")
       _T("rack_id,rack_image,rack_position,rack_height,")
       _T("last_agent_comm_time,syslog_msg_count,snmp_trap_count,")
@@ -325,30 +322,29 @@ bool Node::loadFromDatabase(DB_HANDLE hdb, UINT32 dwId)
 
    DBGetField(hResult, 0, 0, m_primaryName, MAX_DNS_NAME);
    m_ipAddress = DBGetFieldInetAddr(hResult, 0, 1);
-   m_flags = DBGetFieldULong(hResult, 0, 2);
-   m_snmpVersion = DBGetFieldLong(hResult, 0, 3);
-   m_agentAuthMethod = (WORD)DBGetFieldLong(hResult, 0, 4);
-   DBGetField(hResult, 0, 5, m_szSharedSecret, MAX_SECRET_LENGTH);
-   m_agentPort = (WORD)DBGetFieldLong(hResult, 0, 6);
-   m_iStatusPollType = DBGetFieldLong(hResult, 0, 7);
-   DBGetField(hResult, 0, 8, m_snmpObjectId, MAX_OID_LEN * 4);
-   DBGetField(hResult, 0, 9, m_agentVersion, MAX_AGENT_VERSION_LEN);
-   DBGetField(hResult, 0, 10, m_platformName, MAX_PLATFORM_NAME_LEN);
-   m_pollerNode = DBGetFieldULong(hResult, 0, 11);
-   m_zoneUIN = DBGetFieldULong(hResult, 0, 12);
-   m_agentProxy = DBGetFieldULong(hResult, 0, 13);
-   m_snmpProxy = DBGetFieldULong(hResult, 0, 14);
-   m_iRequiredPollCount = DBGetFieldLong(hResult, 0, 15);
-   m_sysDescription = DBGetField(hResult, 0, 16, NULL, 0);
-   m_nUseIfXTable = (BYTE)DBGetFieldLong(hResult, 0, 17);
-   m_snmpPort = (WORD)DBGetFieldLong(hResult, 0, 18);
+   m_snmpVersion = DBGetFieldLong(hResult, 0, 2);
+   m_agentAuthMethod = (WORD)DBGetFieldLong(hResult, 0, 3);
+   DBGetField(hResult, 0, 4, m_szSharedSecret, MAX_SECRET_LENGTH);
+   m_agentPort = (WORD)DBGetFieldLong(hResult, 0, 5);
+   m_iStatusPollType = DBGetFieldLong(hResult, 0, 6);
+   DBGetField(hResult, 0, 7, m_snmpObjectId, MAX_OID_LEN * 4);
+   DBGetField(hResult, 0, 8, m_agentVersion, MAX_AGENT_VERSION_LEN);
+   DBGetField(hResult, 0, 9, m_platformName, MAX_PLATFORM_NAME_LEN);
+   m_pollerNode = DBGetFieldULong(hResult, 0, 10);
+   m_zoneUIN = DBGetFieldULong(hResult, 0, 11);
+   m_agentProxy = DBGetFieldULong(hResult, 0, 12);
+   m_snmpProxy = DBGetFieldULong(hResult, 0, 13);
+   m_iRequiredPollCount = DBGetFieldLong(hResult, 0, 14);
+   m_sysDescription = DBGetField(hResult, 0, 15, NULL, 0);
+   m_nUseIfXTable = (BYTE)DBGetFieldLong(hResult, 0, 16);
+   m_snmpPort = (WORD)DBGetFieldLong(hResult, 0, 17);
 
    // SNMP authentication parameters
    char snmpAuthObject[256], snmpAuthPassword[256], snmpPrivPassword[256];
-   DBGetFieldA(hResult, 0, 19, snmpAuthObject, 256);
-   DBGetFieldA(hResult, 0, 20, snmpAuthPassword, 256);
-   DBGetFieldA(hResult, 0, 21, snmpPrivPassword, 256);
-   int snmpMethods = DBGetFieldLong(hResult, 0, 22);
+   DBGetFieldA(hResult, 0, 18, snmpAuthObject, 256);
+   DBGetFieldA(hResult, 0, 19, snmpAuthPassword, 256);
+   DBGetFieldA(hResult, 0, 20, snmpPrivPassword, 256);
+   int snmpMethods = DBGetFieldLong(hResult, 0, 21);
    delete m_snmpSecurity;
    if (m_snmpVersion == SNMP_VERSION_3)
    {
@@ -365,51 +361,48 @@ bool Node::loadFromDatabase(DB_HANDLE hdb, UINT32 dwId)
       m_snmpSecurity->setPrivPassword(snmpPrivPassword);
    }
 
-   m_sysName = DBGetField(hResult, 0, 23, NULL, 0);
+   m_sysName = DBGetField(hResult, 0, 22, NULL, 0);
 
    TCHAR baseAddr[16];
-   TCHAR *value = DBGetField(hResult, 0, 24, baseAddr, 16);
+   TCHAR *value = DBGetField(hResult, 0, 23, baseAddr, 16);
    if (value != NULL)
       StrToBin(value, m_baseBridgeAddress, MAC_ADDR_LENGTH);
 
-   m_dwDynamicFlags = DBGetFieldULong(hResult, 0, 25);
-   m_dwDynamicFlags &= NDF_PERSISTENT; // Clear out all non-persistent runtime flags
-
-   m_downSince = DBGetFieldLong(hResult, 0, 26);
-   m_bootTime = DBGetFieldLong(hResult, 0, 27);
+   m_downSince = DBGetFieldLong(hResult, 0, 24);
+   m_bootTime = DBGetFieldLong(hResult, 0, 25);
 
    // Setup driver
    TCHAR driverName[34];
-   DBGetField(hResult, 0, 28, driverName, 34);
+   DBGetField(hResult, 0, 26, driverName, 34);
    StrStrip(driverName);
    if (driverName[0] != 0)
       m_driver = FindDriverByName(driverName);
 
-   m_icmpProxy = DBGetFieldULong(hResult, 0, 29);
-   m_agentCacheMode = (INT16)DBGetFieldLong(hResult, 0, 30);
+   m_icmpProxy = DBGetFieldULong(hResult, 0, 27);
+   m_agentCacheMode = (INT16)DBGetFieldLong(hResult, 0, 28);
    if ((m_agentCacheMode != AGENT_CACHE_ON) && (m_agentCacheMode != AGENT_CACHE_OFF))
       m_agentCacheMode = AGENT_CACHE_DEFAULT;
 
-   m_sysContact = DBGetField(hResult, 0, 31, NULL, 0);
-   m_sysLocation = DBGetField(hResult, 0, 32, NULL, 0);
-
-   m_rackId = DBGetFieldULong(hResult, 0, 33);
-   m_rackImage = DBGetFieldGUID(hResult, 0, 34);
-   m_rackPosition = (INT16)DBGetFieldLong(hResult, 0, 35);
-   m_rackHeight = (INT16)DBGetFieldLong(hResult, 0, 36);
-   m_lastAgentCommTime = DBGetFieldLong(hResult, 0, 37);
-   m_syslogMessageCount = DBGetFieldInt64(hResult, 0, 38);
-   m_snmpTrapCount = DBGetFieldInt64(hResult, 0, 39);
-   m_type = (NodeType)DBGetFieldLong(hResult, 0, 40);
-   DBGetField(hResult, 0, 41, m_subType, MAX_NODE_SUBTYPE_LENGTH);
-   DBGetField(hResult, 0, 42, m_sshLogin, MAX_SSH_LOGIN_LEN);
-   DBGetField(hResult, 0, 43, m_sshPassword, MAX_SSH_PASSWORD_LEN);
-   m_sshProxy = DBGetFieldULong(hResult, 0, 44);
-   m_portRowCount = DBGetFieldULong(hResult, 0, 45);
-   m_portNumberingScheme = DBGetFieldULong(hResult, 0, 46);
-   m_agentCompressionMode = (INT16)DBGetFieldLong(hResult, 0, 47);
-   m_tunnelId = DBGetFieldGUID(hResult, 0, 48);
-   m_lldpNodeId = DBGetField(hResult, 0, 49, NULL, 0);
+   m_sysContact = DBGetField(hResult, 0, 29, NULL, 0);
+   m_sysLocation = DBGetField(hResult, 0, 30, NULL, 0);
+
+   m_rackId = DBGetFieldULong(hResult, 0, 31);
+   m_rackImage = DBGetFieldGUID(hResult, 0, 32);
+   m_rackPosition = (INT16)DBGetFieldLong(hResult, 0, 33);
+   m_rackHeight = (INT16)DBGetFieldLong(hResult, 0, 34);
+   m_lastAgentCommTime = DBGetFieldLong(hResult, 0, 35);
+   m_syslogMessageCount = DBGetFieldInt64(hResult, 0, 36);
+   m_snmpTrapCount = DBGetFieldInt64(hResult, 0, 37);
+   m_type = (NodeType)DBGetFieldLong(hResult, 0, 38);
+   DBGetField(hResult, 0, 39, m_subType, MAX_NODE_SUBTYPE_LENGTH);
+   DBGetField(hResult, 0, 40, m_sshLogin, MAX_SSH_LOGIN_LEN);
+   DBGetField(hResult, 0, 41, m_sshPassword, MAX_SSH_PASSWORD_LEN);
+   m_sshProxy = DBGetFieldULong(hResult, 0, 42);
+   m_portRowCount = DBGetFieldULong(hResult, 0, 43);
+   m_portNumberingScheme = DBGetFieldULong(hResult, 0, 44);
+   m_agentCompressionMode = (INT16)DBGetFieldLong(hResult, 0, 45);
+   m_tunnelId = DBGetFieldGUID(hResult, 0, 46);
+   m_lldpNodeId = DBGetField(hResult, 0, 47, NULL, 0);
    if ((m_lldpNodeId != NULL) && (*m_lldpNodeId == 0))
       safe_free_and_null(m_lldpNodeId);
 
@@ -502,11 +495,11 @@ BOOL Node::saveToDatabase(DB_HANDLE hdb)
    if (IsDatabaseRecordExist(hdb, _T("nodes"), _T("id"), m_id))
    {
       hStmt = DBPrepare(hdb,
-         _T("UPDATE nodes SET primary_ip=?,primary_name=?,snmp_port=?,node_flags=?,snmp_version=?,community=?,")
+         _T("UPDATE nodes SET primary_ip=?,primary_name=?,snmp_port=?,capabilities=?,snmp_version=?,community=?,")
          _T("status_poll_type=?,agent_port=?,auth_method=?,secret=?,snmp_oid=?,uname=?,agent_version=?,")
          _T("platform_name=?,poller_node_id=?,zone_guid=?,proxy_node=?,snmp_proxy=?,icmp_proxy=?,required_polls=?,")
          _T("use_ifxtable=?,usm_auth_password=?,usm_priv_password=?,usm_methods=?,snmp_sys_name=?,bridge_base_addr=?,")
-         _T("runtime_flags=?,down_since=?,driver_name=?,rack_image=?,rack_position=?,rack_height=?,rack_id=?,boot_time=?,")
+         _T("down_since=?,driver_name=?,rack_image=?,rack_position=?,rack_height=?,rack_id=?,boot_time=?,")
          _T("agent_cache_mode=?,snmp_sys_contact=?,snmp_sys_location=?,last_agent_comm_time=?,")
          _T("syslog_msg_count=?,snmp_trap_count=?,node_type=?,node_subtype=?,ssh_login=?,ssh_password=?,")
          _T("ssh_proxy=?,chassis_id=?,port_rows=?,port_numbering_scheme=?,agent_comp_mode=?,tunnel_id=?,")
@@ -515,14 +508,14 @@ BOOL Node::saveToDatabase(DB_HANDLE hdb)
    else
    {
       hStmt = DBPrepare(hdb,
-        _T("INSERT INTO nodes (primary_ip,primary_name,snmp_port,node_flags,snmp_version,community,status_poll_type,")
+        _T("INSERT INTO nodes (primary_ip,primary_name,snmp_port,capabilities,snmp_version,community,status_poll_type,")
         _T("agent_port,auth_method,secret,snmp_oid,uname,agent_version,platform_name,poller_node_id,zone_guid,")
         _T("proxy_node,snmp_proxy,icmp_proxy,required_polls,use_ifxtable,usm_auth_password,usm_priv_password,usm_methods,")
-        _T("snmp_sys_name,bridge_base_addr,runtime_flags,down_since,driver_name,rack_image,rack_position,rack_height,rack_id,boot_time,")
+        _T("snmp_sys_name,bridge_base_addr,down_since,driver_name,rack_image,rack_position,rack_height,rack_id,boot_time,")
         _T("agent_cache_mode,snmp_sys_contact,snmp_sys_location,last_agent_comm_time,syslog_msg_count,snmp_trap_count,")
         _T("node_type,node_subtype,ssh_login,ssh_password,ssh_proxy,chassis_id,port_rows,port_numbering_scheme,agent_comp_mode,")
         _T("tunnel_id,lldp_id,id) ")
-        _T("VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"));
+        _T("VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"));
    }
    if (hStmt == NULL)
    {
@@ -535,7 +528,7 @@ BOOL Node::saveToDatabase(DB_HANDLE hdb)
    DBBind(hStmt, 1, DB_SQLTYPE_VARCHAR, m_ipAddress.toString(ipAddr), DB_BIND_STATIC);
    DBBind(hStmt, 2, DB_SQLTYPE_VARCHAR, m_primaryName, DB_BIND_STATIC);
    DBBind(hStmt, 3, DB_SQLTYPE_INTEGER, (LONG)m_snmpPort);
-   DBBind(hStmt, 4, DB_SQLTYPE_INTEGER, m_flags);
+   DBBind(hStmt, 4, DB_SQLTYPE_INTEGER, m_capabilities);
    DBBind(hStmt, 5, DB_SQLTYPE_INTEGER, (LONG)m_snmpVersion);
 #ifdef UNICODE
    DBBind(hStmt, 6, DB_SQLTYPE_VARCHAR, WideStringFromMBString(m_snmpSecurity->getCommunity()), DB_BIND_DYNAMIC);
@@ -567,32 +560,31 @@ BOOL Node::saveToDatabase(DB_HANDLE hdb)
    DBBind(hStmt, 24, DB_SQLTYPE_INTEGER, (LONG)snmpMethods);
    DBBind(hStmt, 25, DB_SQLTYPE_VARCHAR, m_sysName, DB_BIND_STATIC);
    DBBind(hStmt, 26, DB_SQLTYPE_VARCHAR, BinToStr(m_baseBridgeAddress, MAC_ADDR_LENGTH, baseAddress), DB_BIND_STATIC);
-   DBBind(hStmt, 27, DB_SQLTYPE_INTEGER, m_dwDynamicFlags);
-   DBBind(hStmt, 28, DB_SQLTYPE_INTEGER, (LONG)m_downSince);
-   DBBind(hStmt, 29, DB_SQLTYPE_VARCHAR, (m_driver != NULL) ? m_driver->getName() : _T(""), DB_BIND_STATIC);
-   DBBind(hStmt, 30, DB_SQLTYPE_VARCHAR, m_rackImage);   // rack image
-   DBBind(hStmt, 31, DB_SQLTYPE_INTEGER, m_rackPosition); // rack position
-   DBBind(hStmt, 32, DB_SQLTYPE_INTEGER, m_rackHeight);   // device height in rack units
-   DBBind(hStmt, 33, DB_SQLTYPE_INTEGER, m_rackId);   // rack ID
-   DBBind(hStmt, 34, DB_SQLTYPE_INTEGER, (LONG)m_bootTime);
-   DBBind(hStmt, 35, DB_SQLTYPE_VARCHAR, _itot(m_agentCacheMode, cacheMode, 10), DB_BIND_STATIC, 1);
-   DBBind(hStmt, 36, DB_SQLTYPE_VARCHAR, m_sysContact, DB_BIND_STATIC);
-   DBBind(hStmt, 37, DB_SQLTYPE_VARCHAR, m_sysLocation, DB_BIND_STATIC);
-   DBBind(hStmt, 38, DB_SQLTYPE_INTEGER, (LONG)m_lastAgentCommTime);
-   DBBind(hStmt, 39, DB_SQLTYPE_BIGINT, m_syslogMessageCount);
-   DBBind(hStmt, 40, DB_SQLTYPE_BIGINT, m_snmpTrapCount);
-   DBBind(hStmt, 41, DB_SQLTYPE_INTEGER, (INT32)m_type);
-   DBBind(hStmt, 42, DB_SQLTYPE_VARCHAR, m_subType, DB_BIND_STATIC);
-   DBBind(hStmt, 43, DB_SQLTYPE_VARCHAR, m_sshLogin, DB_BIND_STATIC);
-   DBBind(hStmt, 44, DB_SQLTYPE_VARCHAR, m_sshPassword, DB_BIND_STATIC);
-   DBBind(hStmt, 45, DB_SQLTYPE_INTEGER, m_sshProxy);
-   DBBind(hStmt, 46, DB_SQLTYPE_INTEGER, m_chassisId);
-   DBBind(hStmt, 47, DB_SQLTYPE_INTEGER, m_portRowCount);
-   DBBind(hStmt, 48, DB_SQLTYPE_INTEGER, m_portNumberingScheme);
-   DBBind(hStmt, 49, DB_SQLTYPE_VARCHAR, _itot(m_agentCompressionMode, compressionMode, 10), DB_BIND_STATIC, 1);
-   DBBind(hStmt, 50, DB_SQLTYPE_VARCHAR, m_tunnelId);
-   DBBind(hStmt, 51, DB_SQLTYPE_VARCHAR, m_lldpNodeId, DB_BIND_STATIC);
-   DBBind(hStmt, 52, DB_SQLTYPE_INTEGER, m_id);
+   DBBind(hStmt, 27, DB_SQLTYPE_INTEGER, (LONG)m_downSince);
+   DBBind(hStmt, 28, DB_SQLTYPE_VARCHAR, (m_driver != NULL) ? m_driver->getName() : _T(""), DB_BIND_STATIC);
+   DBBind(hStmt, 29, DB_SQLTYPE_VARCHAR, m_rackImage);   // rack image
+   DBBind(hStmt, 30, DB_SQLTYPE_INTEGER, m_rackPosition); // rack position
+   DBBind(hStmt, 31, DB_SQLTYPE_INTEGER, m_rackHeight);   // device height in rack units
+   DBBind(hStmt, 32, DB_SQLTYPE_INTEGER, m_rackId);   // rack ID
+   DBBind(hStmt, 33, DB_SQLTYPE_INTEGER, (LONG)m_bootTime);
+   DBBind(hStmt, 34, DB_SQLTYPE_VARCHAR, _itot(m_agentCacheMode, cacheMode, 10), DB_BIND_STATIC, 1);
+   DBBind(hStmt, 35, DB_SQLTYPE_VARCHAR, m_sysContact, DB_BIND_STATIC);
+   DBBind(hStmt, 36, DB_SQLTYPE_VARCHAR, m_sysLocation, DB_BIND_STATIC);
+   DBBind(hStmt, 37, DB_SQLTYPE_INTEGER, (LONG)m_lastAgentCommTime);
+   DBBind(hStmt, 38, DB_SQLTYPE_BIGINT, m_syslogMessageCount);
+   DBBind(hStmt, 39, DB_SQLTYPE_BIGINT, m_snmpTrapCount);
+   DBBind(hStmt, 40, DB_SQLTYPE_INTEGER, (INT32)m_type);
+   DBBind(hStmt, 41, DB_SQLTYPE_VARCHAR, m_subType, DB_BIND_STATIC);
+   DBBind(hStmt, 42, DB_SQLTYPE_VARCHAR, m_sshLogin, DB_BIND_STATIC);
+   DBBind(hStmt, 43, DB_SQLTYPE_VARCHAR, m_sshPassword, DB_BIND_STATIC);
+   DBBind(hStmt, 44, DB_SQLTYPE_INTEGER, m_sshProxy);
+   DBBind(hStmt, 45, DB_SQLTYPE_INTEGER, m_chassisId);
+   DBBind(hStmt, 46, DB_SQLTYPE_INTEGER, m_portRowCount);
+   DBBind(hStmt, 47, DB_SQLTYPE_INTEGER, m_portNumberingScheme);
+   DBBind(hStmt, 48, DB_SQLTYPE_VARCHAR, _itot(m_agentCompressionMode, compressionMode, 10), DB_BIND_STATIC, 1);
+   DBBind(hStmt, 49, DB_SQLTYPE_VARCHAR, m_tunnelId);
+   DBBind(hStmt, 50, DB_SQLTYPE_VARCHAR, m_lldpNodeId, DB_BIND_STATIC);
+   DBBind(hStmt, 51, DB_SQLTYPE_INTEGER, m_id);
 
    BOOL bResult = DBExecute(hStmt);
    DBFreeStatement(hStmt);
@@ -639,18 +631,18 @@ ARP_CACHE *Node::getArpCache()
 {
    ARP_CACHE *pArpCache = NULL;
 
-   if (m_flags & NF_IS_LOCAL_MGMT)
+   if (m_capabilities & NC_IS_LOCAL_MGMT)
    {
       pArpCache = GetLocalArpCache();
    }
-   else if (m_flags & NF_IS_NATIVE_AGENT)
+   else if (m_capabilities & NC_IS_NATIVE_AGENT)
    {
       agentLock();
       if (connectToAgent())
          pArpCache = m_agentConnection->getArpCache();
       agentUnlock();
    }
-   else if (m_flags & NF_IS_SNMP)
+   else if (m_capabilities & NC_IS_SNMP)
    {
       SNMP_Transport *pTransport;
 
@@ -672,7 +664,7 @@ InterfaceList *Node::getInterfaceList()
 {
    InterfaceList *pIfList = NULL;
 
-   if ((m_flags & NF_IS_NATIVE_AGENT) && (!(m_flags & NF_DISABLE_NXCP)))
+   if ((m_capabilities & NC_IS_NATIVE_AGENT) && (!(m_flags & NF_DISABLE_NXCP)))
    {
       agentLock();
       if (connectToAgent())
@@ -681,11 +673,11 @@ InterfaceList *Node::getInterfaceList()
       }
       agentUnlock();
    }
-   if ((pIfList == NULL) && (m_flags & NF_IS_LOCAL_MGMT))
+   if ((pIfList == NULL) && (m_capabilities & NC_IS_LOCAL_MGMT))
    {
       pIfList = GetLocalInterfaceList();
    }
-   if ((pIfList == NULL) && (m_flags & NF_IS_SNMP) &&
+   if ((pIfList == NULL) && (m_capabilities & NC_IS_SNMP) &&
        (!(m_flags & NF_DISABLE_SNMP)) && (m_driver != NULL))
    {
       SNMP_Transport *pTransport = createSnmpTransport();
@@ -704,7 +696,7 @@ InterfaceList *Node::getInterfaceList()
          int useAliases = ConfigReadInt(_T("UseInterfaceAliases"), 0);
          pIfList = m_driver->getInterfaces(pTransport, &m_customAttributes, m_driverData, useAliases, useIfXTable);
 
-         if ((pIfList != NULL) && (m_flags & NF_IS_BRIDGE))
+         if ((pIfList != NULL) && (m_capabilities & NC_IS_BRIDGE))
          {
             BridgeMapPorts(pTransport, pIfList);
          }
@@ -1312,17 +1304,17 @@ void Node::statusPoll(PollerInfo *poller)
  */
 void Node::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller)
 {
-   if (m_dwDynamicFlags & NDF_DELETE_IN_PROGRESS)
+   if (m_runtimeFlags & DCDF_DELETE_IN_PROGRESS)
    {
       if (dwRqId == 0)
-         m_dwDynamicFlags &= ~NDF_QUEUED_FOR_STATUS_POLL;
+         m_runtimeFlags &= ~DCDF_QUEUED_FOR_STATUS_POLL;
       return;
    }
 
    if (IsShutdownInProgress())
       return;
 
-   UINT32 dwOldFlags = m_flags;
+   UINT32 dwOldFlags = m_capabilities;
    NetObj *pPollerNode = NULL, **ppPollList;
    SNMP_Transport *pTransport;
    Cluster *pCluster;
@@ -1358,7 +1350,7 @@ restart_agent_check:
    }
 
    // Check SNMP agent connectivity
-   if ((m_flags & NF_IS_SNMP) && (!(m_flags & NF_DISABLE_SNMP)) && m_ipAddress.isValidUnicast())
+   if ((m_capabilities & NC_IS_SNMP) && (!(m_flags & NF_DISABLE_SNMP)) && m_ipAddress.isValidUnicast())
    {
       TCHAR szBuffer[256];
       UINT32 dwResult;
@@ -1377,9 +1369,9 @@ restart_agent_check:
          dwResult = SnmpGet(m_snmpVersion, pTransport, testOid, NULL, 0, szBuffer, sizeof(szBuffer), 0);
          if ((dwResult == SNMP_ERR_SUCCESS) || (dwResult == SNMP_ERR_NO_OBJECT))
          {
-            if (m_dwDynamicFlags & NDF_SNMP_UNREACHABLE)
+            if (m_state & NSF_SNMP_UNREACHABLE)
             {
-               m_dwDynamicFlags &= ~NDF_SNMP_UNREACHABLE;
+               m_state &= ~NSF_SNMP_UNREACHABLE;
                PostEventEx(pQueue, EVENT_SNMP_OK, m_id, NULL);
                sendPollerMsg(dwRqId, POLLER_INFO _T("Connectivity with SNMP agent restored\r\n"));
             }
@@ -1421,19 +1413,19 @@ restart_agent_check:
             }
 
             sendPollerMsg(dwRqId, POLLER_ERROR _T("SNMP agent unreachable\r\n"));
-            if (m_dwDynamicFlags & NDF_SNMP_UNREACHABLE)
+            if (m_state & NSF_SNMP_UNREACHABLE)
             {
-               if ((tNow > m_failTimeSNMP + tExpire) && (!(m_dwDynamicFlags & NDF_UNREACHABLE)))
+               if ((tNow > m_failTimeSNMP + tExpire) && (!(m_state & NSF_UNREACHABLE)))
                {
-                  m_flags &= ~NF_IS_SNMP;
-                  m_dwDynamicFlags &= ~NDF_SNMP_UNREACHABLE;
+                  m_capabilities &= ~NC_IS_SNMP;
+                  m_state &= ~NSF_SNMP_UNREACHABLE;
                   m_snmpObjectId[0] = 0;
                   sendPollerMsg(dwRqId, POLLER_WARNING _T("Attribute isSNMP set to FALSE\r\n"));
                }
             }
             else
             {
-               m_dwDynamicFlags |= NDF_SNMP_UNREACHABLE;
+               m_state |= NSF_SNMP_UNREACHABLE;
                PostEventEx(pQueue, EVENT_SNMP_FAIL, m_id, NULL);
                m_failTimeSNMP = tNow;
             }
@@ -1448,7 +1440,7 @@ restart_agent_check:
    }
 
    // Check native agent connectivity
-   if ((m_flags & NF_IS_NATIVE_AGENT) && (!(m_flags & NF_DISABLE_NXCP)))
+   if ((m_capabilities & NC_IS_NATIVE_AGENT) && (!(m_flags & NF_DISABLE_NXCP)))
    {
       nxlog_debug(6, _T("StatusPoll(%s): checking agent"), m_name);
       poller->setStatus(_T("check agent"));
@@ -1460,9 +1452,9 @@ restart_agent_check:
       if (connectToAgent(&error, &socketError, &newConnection, true))
       {
          nxlog_debug(7, _T("StatusPoll(%s): connected to agent"), m_name);
-         if (m_dwDynamicFlags & NDF_AGENT_UNREACHABLE)
+         if (m_state & NSF_AGENT_UNREACHABLE)
          {
-            m_dwDynamicFlags &= ~NDF_AGENT_UNREACHABLE;
+            m_state &= ~NSF_AGENT_UNREACHABLE;
             PostEventEx(pQueue, EVENT_AGENT_OK, m_id, NULL);
             sendPollerMsg(dwRqId, POLLER_INFO _T("Connectivity with NetXMS agent restored\r\n"));
          }
@@ -1472,12 +1464,12 @@ restart_agent_check:
       {
          nxlog_debug(6, _T("StatusPoll(%s): agent unreachable, error=%d, socketError=%d"), m_name, (int)error, (int)socketError);
          sendPollerMsg(dwRqId, POLLER_ERROR _T("NetXMS agent unreachable\r\n"));
-         if (m_dwDynamicFlags & NDF_AGENT_UNREACHABLE)
+         if (m_state & NSF_AGENT_UNREACHABLE)
          {
-            if ((tNow > m_failTimeAgent + tExpire) && !(m_dwDynamicFlags & NDF_UNREACHABLE))
+            if ((tNow > m_failTimeAgent + tExpire) && !(m_state & NSF_UNREACHABLE))
             {
-               m_flags &= ~NF_IS_NATIVE_AGENT;
-               m_dwDynamicFlags &= ~NDF_AGENT_UNREACHABLE;
+               m_capabilities &= ~NC_IS_NATIVE_AGENT;
+               m_state &= ~NSF_AGENT_UNREACHABLE;
                m_platformName[0] = 0;
                m_agentVersion[0] = 0;
                sendPollerMsg(dwRqId, POLLER_WARNING _T("Attribute isNetXMSAgent set to FALSE\r\n"));
@@ -1485,7 +1477,7 @@ restart_agent_check:
          }
          else
          {
-            m_dwDynamicFlags |= NDF_AGENT_UNREACHABLE;
+            m_state |= NSF_AGENT_UNREACHABLE;
             PostEventEx(pQueue, EVENT_AGENT_FAIL, m_id, NULL);
             m_failTimeAgent = tNow;
             //cancel file monitoring locally(on agent it is canceled if agent have fallen)
@@ -1608,26 +1600,26 @@ restart_agent_check:
          }
       }
       unlockChildList();
-      if (allDown && (m_flags & NF_IS_NATIVE_AGENT) &&
+      if (allDown && (m_capabilities & NC_IS_NATIVE_AGENT) &&
           (!(m_flags & NF_DISABLE_NXCP)))
-         if (!(m_dwDynamicFlags & NDF_AGENT_UNREACHABLE))
+         if (!(m_state & NSF_AGENT_UNREACHABLE))
             allDown = false;
-      if (allDown && (m_flags & NF_IS_SNMP) &&
+      if (allDown && (m_capabilities & NC_IS_SNMP) &&
           (!(m_flags & NF_DISABLE_SNMP)))
-         if (!(m_dwDynamicFlags & NDF_SNMP_UNREACHABLE))
+         if (!(m_state & NSF_SNMP_UNREACHABLE))
             allDown = false;
 
-      DbgPrintf(6, _T("StatusPoll(%s): allDown=%s, dynFlags=0x%08X"), m_name, allDown ? _T("true") : _T("false"), m_dwDynamicFlags);
+      DbgPrintf(6, _T("StatusPoll(%s): allDown=%s, statFlags=0x%08X"), m_name, allDown ? _T("true") : _T("false"), m_state);
       if (allDown)
       {
-         if (!(m_dwDynamicFlags & NDF_UNREACHABLE))
+         if (!(m_state & NSF_UNREACHABLE))
          {
-            m_dwDynamicFlags |= NDF_UNREACHABLE;
+            m_state |= NSF_UNREACHABLE;
             m_downSince = time(NULL);
             poller->setStatus(_T("check network path"));
             if (checkNetworkPath(dwRqId))
             {
-               m_dwDynamicFlags |= NDF_NETWORK_PATH_PROBLEM;
+               m_state |= NSF_NETWORK_PATH_PROBLEM;
 
                // Set interfaces and network services to UNKNOWN state
                lockChildList(false);
@@ -1668,10 +1660,10 @@ restart_agent_check:
       else
       {
          m_downSince = 0;
-         if (m_dwDynamicFlags & NDF_UNREACHABLE)
+         if (m_state & NSF_UNREACHABLE)
          {
-            int reason = (m_dwDynamicFlags & NDF_NETWORK_PATH_PROBLEM) ? 1 : 0;
-            m_dwDynamicFlags &= ~(NDF_UNREACHABLE | NDF_SNMP_UNREACHABLE | NDF_AGENT_UNREACHABLE | NDF_NETWORK_PATH_PROBLEM);
+            int reason = (m_state & NSF_NETWORK_PATH_PROBLEM) ? 1 : 0;
+            m_state &= ~(NSF_UNREACHABLE | NSF_SNMP_UNREACHABLE | NSF_AGENT_UNREACHABLE | NSF_NETWORK_PATH_PROBLEM);
             PostEvent(EVENT_NODE_UP, m_id, "d", reason);
             sendPollerMsg(dwRqId, POLLER_INFO _T("Node recovered from unreachable state\r\n"));
             goto restart_agent_check;
@@ -1684,7 +1676,7 @@ restart_agent_check:
    }
 
    // Get uptime and update boot time
-   if (!(m_dwDynamicFlags & NDF_UNREACHABLE))
+   if (!(m_state & NSF_UNREACHABLE))
    {
       TCHAR buffer[MAX_RESULT_LENGTH];
       if (getItemFromAgent(_T("System.Uptime"), MAX_RESULT_LENGTH, buffer) == DCE_SUCCESS)
@@ -1708,7 +1700,7 @@ restart_agent_check:
    }
 
    // Get agent uptime to check if it was restared
-   if (!(m_dwDynamicFlags & NDF_UNREACHABLE) && isNativeAgent())
+   if (!(m_state & NSF_UNREACHABLE) && isNativeAgent())
    {
       TCHAR buffer[MAX_RESULT_LENGTH];
       if (getItemFromAgent(_T("Agent.Uptime"), MAX_RESULT_LENGTH, buffer) == DCE_SUCCESS)
@@ -1734,7 +1726,7 @@ restart_agent_check:
    }
 
    // Get geolocation
-   if (!(m_dwDynamicFlags & NDF_UNREACHABLE) && isNativeAgent())
+   if (!(m_state & NSF_UNREACHABLE) && isNativeAgent())
    {
       TCHAR buffer[MAX_RESULT_LENGTH];
       if (getItemFromAgent(_T("GPS.LocationData"), MAX_RESULT_LENGTH, buffer) == DCE_SUCCESS)
@@ -1756,7 +1748,7 @@ restart_agent_check:
    }
 
    // Get agent log and agent local database status
-   if (!(m_dwDynamicFlags & NDF_UNREACHABLE) && isNativeAgent())
+   if (!(m_state & NSF_UNREACHABLE) && isNativeAgent())
    {
       TCHAR buffer[MAX_RESULT_LENGTH];
       if (getItemFromAgent(_T("Agent.LogFile.Status"), MAX_RESULT_LENGTH, buffer) == DCE_SUCCESS)
@@ -1812,9 +1804,9 @@ restart_agent_check:
    if (pPollerNode != NULL)
       pPollerNode->decRefCount();
 
-   if (dwOldFlags != m_flags)
+   if (dwOldFlags != m_capabilities) //currectly not flags but capabilities
    {
-      PostEvent(EVENT_NODE_FLAGS_CHANGED, m_id, "xx", dwOldFlags, m_flags);
+      PostEvent(EVENT_NODE_FLAGS_CHANGED, m_id, "xx", dwOldFlags, m_capabilities);
       lockProperties();
       setModified();
       unlockProperties();
@@ -1826,7 +1818,7 @@ restart_agent_check:
    sendPollerMsg(dwRqId, _T("Node status after poll is %s\r\n"), GetStatusAsText(m_status, true));
    m_pollRequestor = NULL;
    if (dwRqId == 0)
-      m_dwDynamicFlags &= ~NDF_QUEUED_FOR_STATUS_POLL;
+      m_runtimeFlags &= ~DCDF_QUEUED_FOR_STATUS_POLL;
    pollerUnlock();
    DbgPrintf(5, _T("Finished status poll for node %s (ID: %d)"), m_name, m_id);
 }
@@ -1859,7 +1851,7 @@ bool Node::checkNetworkPathElement(UINT32 nodeId, const TCHAR *nodeType, bool is
       sendPollerMsg(requestId, POLLER_WARNING _T("   %s %s is down\r\n"), nodeType, node->getName());
       return true;
    }
-   if (isProxy && node->isNativeAgent() && (node->getRuntimeFlags() & NDF_AGENT_UNREACHABLE))
+   if (isProxy && node->isNativeAgent() && (node->getState() & NSF_AGENT_UNREACHABLE))
    {
       DbgPrintf(5, _T("Node::checkNetworkPathElement(%s [%d]): agent on %s %s [%d] is down"),
                 m_name, m_id, nodeType, node->getName(), node->getId());
@@ -2217,7 +2209,7 @@ static int PackageNameComparator(const SoftwarePackage **p1, const SoftwarePacka
  */
 bool Node::updateSoftwarePackages(PollerInfo *poller, UINT32 requestId)
 {
-   if (!(m_flags & NF_IS_NATIVE_AGENT))
+   if (!(m_capabilities & NC_IS_NATIVE_AGENT))
       return false;
 
    poller->setStatus(_T("software check"));
@@ -2287,16 +2279,13 @@ bool Node::updateSoftwarePackages(PollerInfo *poller, UINT32 requestId)
    return true;
 }
 
+
 /**
- * Entry point for configuration poller
+ * Perform standard configuration poll on node
  */
-void Node::configurationPoll(PollerInfo *poller)
+void Node::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller)
 {
-   poller->startExecution();
-   ObjectTransactionStart();
-   configurationPoll(NULL, 0, poller, 0);
-   ObjectTransactionEnd();
-   delete poller;
+   configurationPoll(pSession, dwRqId, poller, 0);
 }
 
 /**
@@ -2304,17 +2293,17 @@ void Node::configurationPoll(PollerInfo *poller)
  */
 void Node::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller, int maskBits)
 {
-   if (m_dwDynamicFlags & NDF_DELETE_IN_PROGRESS)
+   if (m_state & DCDF_DELETE_IN_PROGRESS)
    {
       if (dwRqId == 0)
-         m_dwDynamicFlags &= ~NDF_QUEUED_FOR_CONFIG_POLL;
+         m_runtimeFlags &= ~DCDF_QUEUED_FOR_CONFIGURATION_POLL;
       return;
    }
 
    if (IsShutdownInProgress())
       return;
 
-   UINT32 dwOldFlags = m_flags;
+   UINT32 dwOldFlags = m_capabilities;
    TCHAR szBuffer[4096];
    bool hasChanges = false;
 
@@ -2332,15 +2321,11 @@ void Node::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo
    nxlog_debug(4, _T("Starting configuration poll for node %s (ID: %d)"), m_name, m_id);
 
    // Check for forced capabilities recheck
-   if (m_dwDynamicFlags & NDF_RECHECK_CAPABILITIES)
+   if (m_runtimeFlags & NDF_RECHECK_CAPABILITIES)
    {
       sendPollerMsg(dwRqId, POLLER_WARNING _T("Capability reset\r\n"));
-      m_flags &= ~(NF_IS_NATIVE_AGENT | NF_IS_SNMP | NF_IS_CPSNMP |
-                     NF_IS_BRIDGE | NF_IS_ROUTER | NF_IS_OSPF | NF_IS_PRINTER |
-                     NF_IS_CDP | NF_IS_LLDP | NF_IS_SONMP | NF_IS_VRRP | NF_HAS_VLANS |
-                     NF_IS_8021X | NF_IS_STP | NF_HAS_ENTITY_MIB | NF_HAS_IFXTABLE |
-                     NF_HAS_WINPDH);
-      m_dwDynamicFlags &= ~NDF_CONFIGURATION_POLL_PASSED;
+      m_capabilities = 0;
+      m_runtimeFlags &= ~DCDF_CONFIGURATION_POLL_PASSED;
       m_snmpObjectId[0] = 0;
       m_platformName[0] = 0;
       m_agentVersion[0] = 0;
@@ -2352,7 +2337,7 @@ void Node::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo
    }
 
    // Check if node is marked as unreachable
-   if ((m_dwDynamicFlags & NDF_UNREACHABLE) && !(m_dwDynamicFlags & NDF_RECHECK_CAPABILITIES))
+   if ((m_state & NSF_UNREACHABLE) && !(m_runtimeFlags & NDF_RECHECK_CAPABILITIES))
    {
       sendPollerMsg(dwRqId, POLLER_WARNING _T("Node is marked as unreachable, configuration poll aborted\r\n"));
       DbgPrintf(4, _T("Node is marked as unreachable, configuration poll aborted"));
@@ -2374,7 +2359,7 @@ void Node::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo
       if (ConfigReadInt(_T("EnableCheckPointSNMP"), 0))
       {
          nxlog_debug(5, _T("ConfPoll(%s): checking for CheckPoint SNMP on port 260"), m_name);
-         if (!((m_flags & NF_IS_CPSNMP) && (m_dwDynamicFlags & NDF_CPSNMP_UNREACHABLE)) && m_ipAddress.isValidUnicast())
+         if (!((m_capabilities & NC_IS_CPSNMP) && (m_state & NSF_CPSNMP_UNREACHABLE)) && m_ipAddress.isValidUnicast())
          {
             SNMP_Transport *pTransport = new SNMP_UDPTransport;
             ((SNMP_UDPTransport *)pTransport)->createUDPTransport(m_ipAddress, CHECKPOINT_SNMP_PORT);
@@ -2382,8 +2367,8 @@ void Node::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo
                         _T(".1.3.6.1.4.1.2620.1.1.10.0"), NULL, 0, szBuffer, sizeof(szBuffer), 0) == SNMP_ERR_SUCCESS)
             {
                lockProperties();
-               m_flags |= NF_IS_CPSNMP | NF_IS_ROUTER;
-               m_dwDynamicFlags &= ~NDF_CPSNMP_UNREACHABLE;
+               m_capabilities |= NC_IS_CPSNMP | NC_IS_ROUTER;
+               m_state &= ~NSF_CPSNMP_UNREACHABLE;
                unlockProperties();
                sendPollerMsg(dwRqId, POLLER_INFO _T("   CheckPoint SNMP agent on port 260 is active\r\n"));
             }
@@ -2392,9 +2377,9 @@ void Node::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo
       }
 
       // Generate event if node flags has been changed
-      if (dwOldFlags != m_flags)
+      if (dwOldFlags != m_capabilities)
       {
-         PostEvent(EVENT_NODE_FLAGS_CHANGED, m_id, "xx", dwOldFlags, m_flags);
+         PostEvent(EVENT_NODE_FLAGS_CHANGED, m_id, "xx", dwOldFlags, m_capabilities);
          hasChanges = true;
       }
 
@@ -2461,7 +2446,7 @@ void Node::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo
       }
 
       // Setup permanent connection to agent if not present (needed for proper configuration re-sync)
-      if (m_flags & NF_IS_NATIVE_AGENT)
+      if (m_capabilities & NC_IS_NATIVE_AGENT)
       {
          agentLock();
          connectToAgent();
@@ -2488,14 +2473,14 @@ void Node::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo
       sendPollerMsg(dwRqId, _T("Finished configuration poll for node %s\r\n"), m_name);
       sendPollerMsg(dwRqId, _T("Node configuration was%schanged after poll\r\n"), hasChanges ? _T(" ") : _T(" not "));
 
-      m_dwDynamicFlags |= NDF_CONFIGURATION_POLL_PASSED;
+      m_runtimeFlags |= DCDF_CONFIGURATION_POLL_PASSED;
    }
 
    // Finish configuration poll
    poller->setStatus(_T("cleanup"));
    if (dwRqId == 0)
-      m_dwDynamicFlags &= ~NDF_QUEUED_FOR_CONFIG_POLL;
-   m_dwDynamicFlags &= ~NDF_RECHECK_CAPABILITIES;
+      m_runtimeFlags &= ~DCDF_QUEUED_FOR_CONFIGURATION_POLL;
+   m_runtimeFlags &= ~NDF_RECHECK_CAPABILITIES;
    pollerUnlock();
    DbgPrintf(4, _T("Finished configuration poll for node %s (ID: %d)"), m_name, m_id);
 
@@ -2513,7 +2498,7 @@ void Node::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo
 NodeType Node::detectNodeType()
 {
    NodeType type = NODE_TYPE_UNKNOWN;
-   if (m_flags & NF_IS_SNMP)
+   if (m_capabilities & NC_IS_SNMP)
    {
       nxlog_debug(6, _T("Node::detectNodeType(%s [%d]): SNMP node, driver name is %s"), m_name, m_id, m_driver->getName());
 
@@ -2525,7 +2510,7 @@ NodeType Node::detectNodeType()
       }
       else
       {
-         if (m_flags & NF_IS_PRINTER)
+         if (m_capabilities & NC_IS_PRINTER)
          {
             // Assume that printers are physical devices
             type = NODE_TYPE_PHYSICAL;
@@ -2540,8 +2525,8 @@ NodeType Node::detectNodeType()
  */
 bool Node::confPollAgent(UINT32 dwRqId)
 {
-   nxlog_debug(5, _T("ConfPoll(%s): checking for NetXMS agent Flags={%08X} DynamicFlags={%08X}"), m_name, m_flags, m_dwDynamicFlags);
-   if (((m_flags & NF_IS_NATIVE_AGENT) && (m_dwDynamicFlags & NDF_AGENT_UNREACHABLE)) || (m_flags & NF_DISABLE_NXCP))
+   nxlog_debug(5, _T("ConfPoll(%s): checking for NetXMS agent Flags={%08X} StateFlags={%08X} RuntimeFlags={%08X}"), m_name, m_flags, m_state, m_runtimeFlags);
+   if (((m_capabilities & NC_IS_NATIVE_AGENT) && (m_state & NSF_AGENT_UNREACHABLE)) || (m_flags & NF_DISABLE_NXCP))
       return false;
 
    bool hasChanges = false;
@@ -2592,10 +2577,10 @@ bool Node::confPollAgent(UINT32 dwRqId)
    {
       nxlog_debug(5, _T("ConfPoll(%s): checking for NetXMS agent - connected"), m_name);
       lockProperties();
-      m_flags |= NF_IS_NATIVE_AGENT;
-      if (m_dwDynamicFlags & NDF_AGENT_UNREACHABLE)
+      m_capabilities |= NC_IS_NATIVE_AGENT;
+      if (m_state & NSF_AGENT_UNREACHABLE)
       {
-         m_dwDynamicFlags &= ~NDF_AGENT_UNREACHABLE;
+         m_state &= ~NSF_AGENT_UNREACHABLE;
          PostEvent(EVENT_AGENT_OK, m_id, NULL);
          sendPollerMsg(dwRqId, POLLER_INFO _T("   Connectivity with NetXMS agent restored\r\n"));
       }
@@ -2634,9 +2619,9 @@ bool Node::confPollAgent(UINT32 dwRqId)
       if (pAgentConn->getParameter(_T("Net.IP.Forwarding"), 16, buffer) == ERR_SUCCESS)
       {
          if (_tcstoul(buffer, NULL, 10) != 0)
-            m_flags |= NF_IS_ROUTER;
+            m_capabilities |= NC_IS_ROUTER;
          else
-            m_flags &= ~NF_IS_ROUTER;
+            m_capabilities &= ~NC_IS_ROUTER;
       }
 
       // Get uname
@@ -2677,14 +2662,14 @@ bool Node::confPollAgent(UINT32 dwRqId)
          m_tableList = tlist;
 
          // Check for 64-bit interface counters
-         m_flags &= ~NF_HAS_AGENT_IFXCOUNTERS;
+         m_capabilities &= ~NC_HAS_AGENT_IFXCOUNTERS;
          if (netIf64bitCounters)
          {
             for(int i = 0; i < plist->size(); i++)
             {
                if (!_tcsicmp(plist->get(i)->getName(), _T("Net.Interface.BytesIn64(*)")))
                {
-                  m_flags |= NF_HAS_AGENT_IFXCOUNTERS;
+                  m_capabilities |= NC_HAS_AGENT_IFXCOUNTERS;
                   break;
                }
             }
@@ -2708,18 +2693,18 @@ bool Node::confPollAgent(UINT32 dwRqId)
          if (m_winPerfObjects != NULL)
          {
             sendPollerMsg(dwRqId, POLLER_INFO _T("   %d counters read\r\n"), m_winPerfObjects->size());
-            if (!(m_flags & NF_HAS_WINPDH))
+            if (!(m_capabilities & NC_HAS_WINPDH))
             {
-               m_flags |= NF_HAS_WINPDH;
+               m_capabilities |= NC_HAS_WINPDH;
                hasChanges = true;
             }
          }
          else
          {
             sendPollerMsg(dwRqId, POLLER_ERROR _T("   unable to get Windows Performance Counters list\r\n"));
-            if (m_flags & NF_HAS_WINPDH)
+            if (m_capabilities & NC_HAS_WINPDH)
             {
-               m_flags &= ~NF_HAS_WINPDH;
+               m_capabilities &= ~NC_HAS_WINPDH;
                hasChanges = true;
             }
          }
@@ -2753,7 +2738,7 @@ static UINT32 IndicatorSnmpWalkerCallback(SNMP_Variable *var, SNMP_Transport *tr
  */
 bool Node::confPollSnmp(UINT32 dwRqId)
 {
-   if (((m_flags & NF_IS_SNMP) && (m_dwDynamicFlags & NDF_SNMP_UNREACHABLE)) ||
+   if (((m_capabilities & NC_IS_SNMP) && (m_state & NSF_SNMP_UNREACHABLE)) ||
        !m_ipAddress.isValidUnicast() || (m_flags & NF_DISABLE_SNMP))
       return false;
 
@@ -2779,10 +2764,10 @@ bool Node::confPollSnmp(UINT32 dwRqId)
    m_snmpPort = pTransport->getPort();
    delete m_snmpSecurity;
    m_snmpSecurity = new SNMP_SecurityContext(pTransport->getSecurityContext());
-   m_flags |= NF_IS_SNMP;
-   if (m_dwDynamicFlags & NDF_SNMP_UNREACHABLE)
+   m_capabilities |= NC_IS_SNMP;
+   if (m_state & NSF_SNMP_UNREACHABLE)
    {
-      m_dwDynamicFlags &= ~NDF_SNMP_UNREACHABLE;
+      m_state &= ~NSF_SNMP_UNREACHABLE;
       PostEvent(EVENT_SNMP_OK, m_id, NULL);
       sendPollerMsg(dwRqId, POLLER_INFO _T("   Connectivity with SNMP agent restored\r\n"));
    }
@@ -2856,13 +2841,13 @@ bool Node::confPollSnmp(UINT32 dwRqId)
    if (checkSNMPIntegerValue(pTransport, _T(".1.3.6.1.2.1.4.1.0"), 1))
    {
       lockProperties();
-      m_flags |= NF_IS_ROUTER;
+      m_capabilities |= NC_IS_ROUTER;
       unlockProperties();
    }
    else
    {
       lockProperties();
-      m_flags &= ~NF_IS_ROUTER;
+      m_capabilities &= ~NC_IS_ROUTER;
       unlockProperties();
    }
 
@@ -2873,7 +2858,7 @@ bool Node::confPollSnmp(UINT32 dwRqId)
    if (SnmpGet(m_snmpVersion, pTransport, _T(".1.3.6.1.2.1.47.1.4.1.0"), NULL, 0, szBuffer, sizeof(szBuffer), SG_RAW_RESULT) == SNMP_ERR_SUCCESS)
    {
       lockProperties();
-      m_flags |= NF_HAS_ENTITY_MIB;
+      m_capabilities |= NC_HAS_ENTITY_MIB;
       unlockProperties();
 
       ComponentTree *components = BuildComponentTree(this, pTransport);
@@ -2886,7 +2871,7 @@ bool Node::confPollSnmp(UINT32 dwRqId)
    else
    {
       lockProperties();
-      m_flags &= ~NF_HAS_ENTITY_MIB;
+      m_capabilities &= ~NC_HAS_ENTITY_MIB;
       if (m_components != NULL)
       {
          m_components->decRefCount();
@@ -2901,13 +2886,13 @@ bool Node::confPollSnmp(UINT32 dwRqId)
    if (present)
    {
       lockProperties();
-      m_flags |= NF_IS_PRINTER;
+      m_capabilities |= NC_IS_PRINTER;
       unlockProperties();
    }
    else
    {
       lockProperties();
-      m_flags &= ~NF_IS_PRINTER;
+      m_capabilities &= ~NC_IS_PRINTER;
       unlockProperties();
    }
 
@@ -2915,13 +2900,13 @@ bool Node::confPollSnmp(UINT32 dwRqId)
    if (checkSNMPIntegerValue(pTransport, _T(".1.3.6.1.4.1.9.9.23.1.3.1.0"), 1))
    {
       lockProperties();
-      m_flags |= NF_IS_CDP;
+      m_capabilities |= NC_IS_CDP;
       unlockProperties();
    }
    else
    {
       lockProperties();
-      m_flags &= ~NF_IS_CDP;
+      m_capabilities &= ~NC_IS_CDP;
       unlockProperties();
    }
 
@@ -2929,13 +2914,13 @@ bool Node::confPollSnmp(UINT32 dwRqId)
    if (checkSNMPIntegerValue(pTransport, _T(".1.3.6.1.4.1.45.1.6.13.1.2.0"), 1))
    {
       lockProperties();
-      m_flags |= NF_IS_NDP;
+      m_capabilities |= NC_IS_NDP;
       unlockProperties();
    }
    else
    {
       lockProperties();
-      m_flags &= ~NF_IS_NDP;
+      m_capabilities &= ~NC_IS_NDP;
       unlockProperties();
    }
 
@@ -2943,7 +2928,7 @@ bool Node::confPollSnmp(UINT32 dwRqId)
    if (SnmpGet(m_snmpVersion, pTransport, _T(".1.0.8802.1.1.2.1.3.2.0"), NULL, 0, szBuffer, sizeof(szBuffer), 0) == SNMP_ERR_SUCCESS)
    {
       lockProperties();
-      m_flags |= NF_IS_LLDP;
+      m_capabilities |= NC_IS_LLDP;
       unlockProperties();
 
       INT32 type;
@@ -2973,7 +2958,7 @@ bool Node::confPollSnmp(UINT32 dwRqId)
    else
    {
       lockProperties();
-      m_flags &= ~NF_IS_LLDP;
+      m_capabilities &= ~NC_IS_LLDP;
       unlockProperties();
    }
 
@@ -2981,13 +2966,13 @@ bool Node::confPollSnmp(UINT32 dwRqId)
    if (checkSNMPIntegerValue(pTransport, _T(".1.0.8802.1.1.1.1.1.1.0"), 1))
    {
       lockProperties();
-      m_flags |= NF_IS_8021X;
+      m_capabilities |= NC_IS_8021X;
       unlockProperties();
    }
    else
    {
       lockProperties();
-      m_flags &= ~NF_IS_8021X;
+      m_capabilities &= ~NC_IS_8021X;
       unlockProperties();
    }
 
@@ -2998,7 +2983,7 @@ bool Node::confPollSnmp(UINT32 dwRqId)
    if (vrrpInfo != NULL)
    {
       lockProperties();
-      m_flags |= NF_IS_VRRP;
+      m_capabilities |= NC_IS_VRRP;
       delete m_vrrpInfo;
       m_vrrpInfo = vrrpInfo;
       unlockProperties();
@@ -3006,7 +2991,7 @@ bool Node::confPollSnmp(UINT32 dwRqId)
    else
    {
       lockProperties();
-      m_flags &= ~NF_IS_VRRP;
+      m_capabilities &= ~NC_IS_VRRP;
       unlockProperties();
    }
 
@@ -3016,7 +3001,7 @@ bool Node::confPollSnmp(UINT32 dwRqId)
       DbgPrintf(5, _T("ConfPoll(%s): node is wireless controller, reading access point information"), m_name);
       sendPollerMsg(dwRqId, _T("   Reading wireless access point information\r\n"));
       lockProperties();
-      m_flags |= NF_IS_WIFI_CONTROLLER;
+      m_capabilities |= NC_IS_WIFI_CONTROLLER;
       unlockProperties();
 
       int clusterMode = m_driver->getClusterMode(pTransport, &m_customAttributes, m_driverData);
@@ -3084,7 +3069,7 @@ bool Node::confPollSnmp(UINT32 dwRqId)
    else
    {
       lockProperties();
-      m_flags &= ~NF_IS_WIFI_CONTROLLER;
+      m_capabilities &= ~NC_IS_WIFI_CONTROLLER;
       unlockProperties();
    }
 
@@ -3102,8 +3087,8 @@ bool Node::confPollSnmp(UINT32 dwRqId)
             hasChanges = true;
          }
 
-         m_flags |= NF_IS_SNMP | NF_IS_ROUTER;
-         m_dwDynamicFlags &= ~NDF_SNMP_UNREACHABLE;
+         m_capabilities |= NC_IS_SNMP | NC_IS_ROUTER;
+         m_state &= ~NSF_SNMP_UNREACHABLE;
          unlockProperties();
          sendPollerMsg(dwRqId, POLLER_INFO _T("   CheckPoint SNMP agent on port 161 is active\r\n"));
       }
@@ -3144,7 +3129,7 @@ void Node::checkBridgeMib(SNMP_Transport *pTransport)
    if (SnmpGet(m_snmpVersion, pTransport, _T(".1.3.6.1.2.1.17.1.1.0"), NULL, 0, szBuffer, sizeof(szBuffer), SG_RAW_RESULT) == SNMP_ERR_SUCCESS)
    {
       lockProperties();
-      m_flags |= NF_IS_BRIDGE;
+      m_capabilities |= NC_IS_BRIDGE;
       memcpy(m_baseBridgeAddress, szBuffer, 6);
       unlockProperties();
 
@@ -3152,20 +3137,20 @@ void Node::checkBridgeMib(SNMP_Transport *pTransport)
       if (checkSNMPIntegerValue(pTransport, _T(".1.3.6.1.2.1.17.2.1.0"), 3))
       {
          lockProperties();
-         m_flags |= NF_IS_STP;
+         m_capabilities |= NC_IS_STP;
          unlockProperties();
       }
       else
       {
          lockProperties();
-         m_flags &= ~NF_IS_STP;
+         m_capabilities &= ~NC_IS_STP;
          unlockProperties();
       }
    }
    else
    {
       lockProperties();
-      m_flags &= ~(NF_IS_BRIDGE | NF_IS_STP);
+      m_capabilities &= ~(NC_IS_BRIDGE | NC_IS_STP);
       unlockProperties();
    }
 }
@@ -3180,13 +3165,13 @@ void Node::checkIfXTable(SNMP_Transport *pTransport)
    if (present)
    {
       lockProperties();
-      m_flags |= NF_HAS_IFXTABLE;
+      m_capabilities |= NC_HAS_IFXTABLE;
       unlockProperties();
    }
    else
    {
       lockProperties();
-      m_flags &= ~NF_HAS_IFXTABLE;
+      m_capabilities &= ~NC_HAS_IFXTABLE;
       unlockProperties();
    }
 }
@@ -3472,7 +3457,7 @@ bool Node::updateInterfaceConfiguration(UINT32 rqid, int maskBits)
       nxlog_debug(6, _T("Node::updateInterfaceConfiguration(%s [%u]): Unable to get interface list from node"), m_name, m_id);
 
       // Delete all existing interfaces in case of forced capability recheck
-      if (m_dwDynamicFlags & NDF_RECHECK_CAPABILITIES)
+      if (m_runtimeFlags & NDF_RECHECK_CAPABILITIES)
       {
          lockChildList(false);
          Interface **ppDeleteList = (Interface **)malloc(sizeof(Interface *) * m_childList->size());
@@ -3575,124 +3560,6 @@ bool Node::updateInterfaceConfiguration(UINT32 rqid, int maskBits)
 }
 
 /**
- * Entry point for instance discovery poller
- */
-void Node::instanceDiscoveryPoll(PollerInfo *poller)
-{
-   poller->startExecution();
-   ObjectTransactionStart();
-   instanceDiscoveryPoll(NULL, 0, poller);
-   ObjectTransactionEnd();
-   delete poller;
-}
-
-/**
- * Perform instance discovery poll on node
- */
-void Node::instanceDiscoveryPoll(ClientSession *session, UINT32 requestId, PollerInfo *poller)
-{
-   if (m_dwDynamicFlags & NDF_DELETE_IN_PROGRESS)
-   {
-      if (requestId == 0)
-         m_dwDynamicFlags &= ~NDF_QUEUED_FOR_INSTANCE_POLL;
-      return;
-   }
-
-   if (IsShutdownInProgress())
-      return;
-
-   poller->setStatus(_T("wait for lock"));
-   pollerLock();
-
-   if (IsShutdownInProgress())
-   {
-      pollerUnlock();
-      return;
-   }
-
-   m_pollRequestor = session;
-   sendPollerMsg(requestId, _T("Starting instance discovery poll for node %s\r\n"), m_name);
-   DbgPrintf(4, _T("Starting instance discovery poll for node %s (ID: %d)"), m_name, m_id);
-
-   // Check if node is marked as unreachable
-   if (!(m_dwDynamicFlags & NDF_UNREACHABLE))
-   {
-      poller->setStatus(_T("instance discovery"));
-      doInstanceDiscovery(requestId);
-
-      // Execute hook script
-      poller->setStatus(_T("hook"));
-      executeHookScript(_T("InstancePoll"));
-   }
-   else
-   {
-      sendPollerMsg(requestId, POLLER_WARNING _T("Node is marked as unreachable, instance discovery poll aborted\r\n"));
-      DbgPrintf(4, _T("Node is marked as unreachable, instance discovery poll aborted"));
-   }
-
-   m_lastInstancePoll = time(NULL);
-
-   // Finish instance discovery poll
-   poller->setStatus(_T("cleanup"));
-   if (requestId == 0)
-      m_dwDynamicFlags &= ~NDF_QUEUED_FOR_INSTANCE_POLL;
-   pollerUnlock();
-   DbgPrintf(4, _T("Finished instance discovery poll for node %s (ID: %d)"), m_name, m_id);
-}
-
-/**
- * Do instance discovery
- */
-void Node::doInstanceDiscovery(UINT32 requestId)
-{
-   sendPollerMsg(requestId, _T("Running DCI instance discovery\r\n"));
-
-   // collect instance discovery DCIs
-   ObjectArray<DCObject> rootObjects;
-   lockDciAccess(false);
-   for(int i = 0; i < m_dcObjects->size(); i++)
-   {
-      DCObject *object = m_dcObjects->get(i);
-      if (object->getInstanceDiscoveryMethod() != IDM_NONE)
-      {
-         object->setBusyFlag();
-         rootObjects.add(object);
-      }
-   }
-   unlockDciAccess();
-
-   // process instance discovery DCIs
-   // it should be done that way to prevent DCI list lock for long time
-   bool changed = false;
-   for(int i = 0; i < rootObjects.size(); i++)
-   {
-      DCObject *object = rootObjects.get(i);
-      DbgPrintf(5, _T("Node::doInstanceDiscovery(%s [%u]): Updating instances for instance discovery DCO %s [%d]"),
-                m_name, m_id, object->getName(), object->getId());
-      sendPollerMsg(requestId, _T("   Updating instances for %s [%d]\r\n"), object->getName(), object->getId());
-      StringMap *instances = getInstanceList(object);
-      if (instances != NULL)
-      {
-         DbgPrintf(5, _T("Node::doInstanceDiscovery(%s [%u]): read %d values"), m_name, m_id, instances->size());
-         object->filterInstanceList(instances);
-         if (updateInstances(object, instances, requestId))
-            changed = true;
-         delete instances;
-      }
-      else
-      {
-         DbgPrintf(5, _T("Node::doInstanceDiscovery(%s [%u]): failed to get instance list for DCO %s [%d]"),
-                   m_name, m_id, object->getName(), object->getId());
-         sendPollerMsg(requestId, POLLER_ERROR _T("      Failed to get instance list\r\n"));
-      }
-      object->clearBusyFlag();
-   }
-
-   if (changed)
-      onDataCollectionChange();
-}
-
-/**
  * Get instances for instance discovery DCO
  */
 StringMap *Node::getInstanceList(DCObject *dco)
@@ -3755,110 +3622,6 @@ StringMap *Node::getInstanceList(DCObject *dco)
 }
 
 /**
- * Callback for finding instance
- */
-static EnumerationCallbackResult FindInstanceCallback(const TCHAR *key, const void *value, void *data)
-{
-   return !_tcscmp((const TCHAR *)data, key) ? _STOP : _CONTINUE;
-}
-
-/**
- * Data for CreateInstanceDCI
- */
-struct CreateInstanceDCOData
-{
-   DCObject *root;
-   Node *object;
-   UINT32 requestId;
-};
-
-/**
- * Callback for creating instance DCIs
- */
-static EnumerationCallbackResult CreateInstanceDCI(const TCHAR *key, const void *value, void *data)
-{
-   Node *object = ((CreateInstanceDCOData *)data)->object;
-   DCObject *root = ((CreateInstanceDCOData *)data)->root;
-
-   DbgPrintf(5, _T("Node::updateInstances(%s [%u], %s [%u]): creating new DCO for instance \"%s\""),
-             object->getName(), object->getId(), root->getName(), root->getId(), key);
-   object->sendPollerMsg(((CreateInstanceDCOData *)data)->requestId, _T("      Creating new DCO for instance \"%s\"\r\n"), key);
-
-   DCObject *dco = root->clone();
-
-   dco->setTemplateId(object->getId(), root->getId());
-   dco->setInstance((const TCHAR *)value);
-   dco->setInstanceDiscoveryMethod(IDM_NONE);
-   dco->setInstanceDiscoveryData(key);
-   dco->setInstanceFilter(NULL);
-   dco->expandInstance();
-   dco->changeBinding(CreateUniqueId(IDG_ITEM), object, FALSE);
-   object->addDCObject(dco, true);
-   return _CONTINUE;
-}
-
-/**
- * Update instance DCIs created from instance discovery DCI
- */
-bool Node::updateInstances(DCObject *root, StringMap *instances, UINT32 requestId)
-{
-   bool changed = false;
-
-   lockDciAccess(true);
-
-   // Delete DCIs for missing instances and update existing
-   IntegerArray<UINT32> deleteList;
-   for(int i = 0; i < m_dcObjects->size(); i++)
-   {
-      DCObject *object = m_dcObjects->get(i);
-      if ((object->getTemplateId() != m_id) || (object->getTemplateItemId() != root->getId()))
-         continue;
-
-      const TCHAR *dcoInstance = object->getInstanceDiscoveryData();
-      if (instances->forEach(FindInstanceCallback, (void *)dcoInstance) == _STOP)
-      {
-         // found, remove value from instances
-         DbgPrintf(5, _T("Node::updateInstances(%s [%u], %s [%u]): instance \"%s\" found"),
-                   m_name, m_id, root->getName(), root->getId(), dcoInstance);
-         const TCHAR *name = instances->get(dcoInstance);
-         if (_tcscmp(name, object->getInstance()))
-         {
-            object->setInstance(name);
-            object->updateFromTemplate(root);
-            changed = true;
-         }
-         instances->remove(dcoInstance);
-      }
-      else
-      {
-         // not found, delete DCO
-         DbgPrintf(5, _T("Node::updateInstances(%s [%u], %s [%u]): instance \"%s\" not found, instance DCO will be deleted"),
-                   m_name, m_id, root->getName(), root->getId(), dcoInstance);
-         sendPollerMsg(requestId, _T("      Existing instance \"%s\" not found and will be deleted\r\n"), dcoInstance);
-         deleteList.add(object->getId());
-         changed = true;
-      }
-   }
-
-   for(int i = 0; i < deleteList.size(); i++)
-      deleteDCObject(deleteList.get(i), false);
-
-   // Create new instances
-   if (instances->size() > 0)
-   {
-      CreateInstanceDCOData data;
-      data.root = root;
-      data.object = this;
-      data.requestId = requestId;
-      instances->forEach(CreateInstanceDCI, &data);
-      changed = true;
-   }
-
-   unlockDciAccess();
-   return changed;
-}
-
-/**
  * Connect to SM-CLP agent. Assumes that access to SM-CLP connection is already locked.
  */
 bool Node::connectToSMCLP()
@@ -3967,7 +3730,7 @@ bool Node::connectToAgent(UINT32 *error, UINT32 *socketError, bool *newConnectio
          DbgPrintf(5, _T("Node::connectToAgent(%s [%d]): cannot set server ID on agent (%s)"), m_name, m_id, AgentErrorCodeToText(rcc));
          if (rcc == ERR_UNKNOWN_COMMAND)
          {
-            m_dwDynamicFlags |= NDF_CACHE_MODE_NOT_SUPPORTED;
+            m_state |= NSF_CACHE_MODE_NOT_SUPPORTED;
          }
       }
       m_agentConnection->enableTraps();
@@ -4012,8 +3775,8 @@ UINT32 Node::getItemFromSNMP(WORD port, const TCHAR *param, size_t bufSize, TCHA
 {
    UINT32 dwResult;
 
-   if ((((m_dwDynamicFlags & NDF_SNMP_UNREACHABLE) || !(m_flags & NF_IS_SNMP)) && (port == 0)) ||
-       (m_dwDynamicFlags & NDF_UNREACHABLE) ||
+   if ((((m_state & NSF_SNMP_UNREACHABLE) || !(m_capabilities & NC_IS_SNMP)) && (port == 0)) ||
+       (m_state & NSF_UNREACHABLE) ||
        (m_flags & NF_DISABLE_SNMP))
    {
       dwResult = SNMP_ERR_COMM;
@@ -4278,8 +4041,8 @@ UINT32 Node::getItemFromCheckPointSNMP(const TCHAR *szParam, UINT32 dwBufSize, T
 {
    UINT32 dwResult;
 
-   if ((m_dwDynamicFlags & NDF_CPSNMP_UNREACHABLE) ||
-       (m_dwDynamicFlags & NDF_UNREACHABLE))
+   if ((m_state & NSF_CPSNMP_UNREACHABLE) ||
+       (m_state & NSF_UNREACHABLE))
    {
       dwResult = SNMP_ERR_COMM;
    }
@@ -4301,10 +4064,10 @@ UINT32 Node::getItemFromCheckPointSNMP(const TCHAR *szParam, UINT32 dwBufSize, T
  */
 UINT32 Node::getItemFromAgent(const TCHAR *szParam, UINT32 dwBufSize, TCHAR *szBuffer)
 {
-   if ((m_dwDynamicFlags & NDF_AGENT_UNREACHABLE) ||
-       (m_dwDynamicFlags & NDF_UNREACHABLE) ||
+   if ((m_state & NSF_AGENT_UNREACHABLE) ||
+       (m_state & NSF_UNREACHABLE) ||
        (m_flags & NF_DISABLE_NXCP) ||
-       !(m_flags & NF_IS_NATIVE_AGENT))
+       !(m_capabilities & NC_IS_NATIVE_AGENT))
       return DCE_COMM_ERROR;
 
    UINT32 dwError = ERR_NOT_CONNECTED, dwResult = DCE_COMM_ERROR;
@@ -4371,10 +4134,10 @@ UINT32 Node::getTableFromAgent(const TCHAR *name, Table **table)
 
    *table = NULL;
 
-   if ((m_dwDynamicFlags & NDF_AGENT_UNREACHABLE) ||
-       (m_dwDynamicFlags & NDF_UNREACHABLE) ||
+   if ((m_state & NSF_AGENT_UNREACHABLE) ||
+       (m_state & NSF_UNREACHABLE) ||
        (m_flags & NF_DISABLE_NXCP) ||
-       !(m_flags & NF_IS_NATIVE_AGENT))
+       !(m_capabilities & NC_IS_NATIVE_AGENT))
       return DCE_COMM_ERROR;
 
    agentLock();
@@ -4438,10 +4201,10 @@ UINT32 Node::getListFromAgent(const TCHAR *name, StringList **list)
 
    *list = NULL;
 
-   if ((m_dwDynamicFlags & NDF_AGENT_UNREACHABLE) ||
-       (m_dwDynamicFlags & NDF_UNREACHABLE) ||
+   if ((m_state & NSF_AGENT_UNREACHABLE) ||
+       (m_state & NSF_UNREACHABLE) ||
        (m_flags & NF_DISABLE_NXCP) ||
-       !(m_flags & NF_IS_NATIVE_AGENT))
+       !(m_capabilities & NC_IS_NATIVE_AGENT))
       return DCE_COMM_ERROR;
 
    agentLock();
@@ -4506,7 +4269,7 @@ UINT32 Node::getItemFromSMCLP(const TCHAR *param, UINT32 bufSize, TCHAR *buffer)
    UINT32 result = DCE_COMM_ERROR;
    int tries = 3;
 
-   if (m_dwDynamicFlags & NDF_UNREACHABLE)
+   if (m_state & NSF_UNREACHABLE)
       return DCE_COMM_ERROR;
 
    smclpLock();
@@ -4562,9 +4325,9 @@ UINT32 Node::getInternalItem(const TCHAR *param, size_t bufSize, TCHAR *buffer)
 
    if (!_tcsicmp(param, _T("AgentStatus")))
    {
-      if (m_flags & NF_IS_NATIVE_AGENT)
+      if (m_capabilities & NC_IS_NATIVE_AGENT)
       {
-         buffer[0] = (m_dwDynamicFlags & NDF_AGENT_UNREACHABLE) ? _T('1') : _T('0');
+         buffer[0] = (m_state & NSF_AGENT_UNREACHABLE) ? _T('1') : _T('0');
          buffer[1] = 0;
       }
       else
@@ -4574,7 +4337,7 @@ UINT32 Node::getInternalItem(const TCHAR *param, size_t bufSize, TCHAR *buffer)
    }
    else if (MatchString(_T("Net.IP.NextHop(*)"), param, FALSE))
    {
-      if ((m_flags & NF_IS_NATIVE_AGENT) || (m_flags & NF_IS_SNMP))
+      if ((m_capabilities & NC_IS_NATIVE_AGENT) || (m_capabilities & NC_IS_SNMP))
       {
          TCHAR arg[256] = _T("");
          AgentGetParameterArg(param, 1, arg, 256);
@@ -4685,7 +4448,7 @@ UINT32 Node::getInternalItem(const TCHAR *param, size_t bufSize, TCHAR *buffer)
    }
    else if (!_tcsicmp(param, _T("WirelessController.AdoptedAPCount")))
    {
-      if (m_flags & NF_IS_WIFI_CONTROLLER)
+      if (m_capabilities & NC_IS_WIFI_CONTROLLER)
       {
          _sntprintf(buffer, bufSize, _T("%d"), m_adoptedApCount);
       }
@@ -4696,7 +4459,7 @@ UINT32 Node::getInternalItem(const TCHAR *param, size_t bufSize, TCHAR *buffer)
    }
    else if (!_tcsicmp(param, _T("WirelessController.TotalAPCount")))
    {
-      if (m_flags & NF_IS_WIFI_CONTROLLER)
+      if (m_capabilities & NC_IS_WIFI_CONTROLLER)
       {
          _sntprintf(buffer, bufSize, _T("%d"), m_totalApCount);
       }
@@ -4707,7 +4470,7 @@ UINT32 Node::getInternalItem(const TCHAR *param, size_t bufSize, TCHAR *buffer)
    }
    else if (!_tcsicmp(param, _T("WirelessController.UnadoptedAPCount")))
    {
-      if (m_flags & NF_IS_WIFI_CONTROLLER)
+      if (m_capabilities & NC_IS_WIFI_CONTROLLER)
       {
          _sntprintf(buffer, bufSize, _T("%d"), m_totalApCount - m_adoptedApCount);
       }
@@ -4716,7 +4479,7 @@ UINT32 Node::getInternalItem(const TCHAR *param, size_t bufSize, TCHAR *buffer)
          rc = DCE_NOT_SUPPORTED;
       }
    }
-   else if (m_flags & NF_IS_LOCAL_MGMT)
+   else if (m_capabilities & NC_IS_LOCAL_MGMT)
    {
       if (!_tcsicmp(param, _T("Server.AverageDBWriterQueueSize")))
       {
@@ -4928,8 +4691,8 @@ void Node::fillMessageInternal(NXCPMessage *pMsg)
    pMsg->setField(VID_PRIMARY_NAME, m_primaryName);
    pMsg->setField(VID_NODE_TYPE, (INT16)m_type);
    pMsg->setField(VID_NODE_SUBTYPE, m_subType);
-   pMsg->setField(VID_FLAGS, m_flags);
-   pMsg->setField(VID_RUNTIME_FLAGS, m_dwDynamicFlags);
+   pMsg->setField(VID_STATE_FLAGS, m_state);
+   pMsg->setField(VID_CAPABILITIES, m_capabilities);
    pMsg->setField(VID_AGENT_PORT, m_agentPort);
    pMsg->setField(VID_AUTH_METHOD, m_agentAuthMethod);
    pMsg->setField(VID_AGENT_CACHE_MODE, m_agentCacheMode);
@@ -4990,9 +4753,7 @@ UINT32 Node::modifyFromMessageInternal(NXCPMessage *pRequest)
    if (pRequest->isFieldExist(VID_FLAGS))
    {
       bool wasRemoteAgent = ((m_flags & NF_REMOTE_AGENT) != 0);
-      UINT32 mask = pRequest->isFieldExist(VID_FLAGS_MASK) ? (pRequest->getFieldAsUInt32(VID_FLAGS_MASK) & NF_USER_FLAGS) : NF_USER_FLAGS;
-      m_flags &= ~mask;
-      m_flags |= pRequest->getFieldAsUInt32(VID_FLAGS) & mask;
+      m_flags = pRequest->getFieldAsUInt32(VID_FLAGS);
       if (wasRemoteAgent && !(m_flags & NF_REMOTE_AGENT) && m_ipAddress.isValidUnicast())
       {
          if (IsZoningEnabled())
@@ -5108,7 +4869,7 @@ UINT32 Node::modifyFromMessageInternal(NXCPMessage *pRequest)
       }
 
       _tcscpy(m_primaryName, primaryName);
-      m_dwDynamicFlags |= NDF_FORCE_CONFIGURATION_POLL | NDF_RECHECK_CAPABILITIES;
+      m_runtimeFlags |= DCDF_FORCE_CONFIGURATION_POLL | NDF_RECHECK_CAPABILITIES;
    }
 
    // Poller node ID
@@ -5493,9 +5254,9 @@ UINT32 Node::checkNetworkService(UINT32 *pdwStatus, const InetAddress& ipAddr, i
    UINT32 dwError = ERR_NOT_CONNECTED;
    *responseTime = 0;
 
-   if ((m_flags & NF_IS_NATIVE_AGENT) &&
-       (!(m_dwDynamicFlags & NDF_AGENT_UNREACHABLE)) &&
-       (!(m_dwDynamicFlags & NDF_UNREACHABLE)))
+   if ((m_capabilities & NC_IS_NATIVE_AGENT) &&
+       (!(m_state & NSF_AGENT_UNREACHABLE)) &&
+       (!(m_state & NSF_UNREACHABLE)))
    {
       AgentConnection *conn = createAgentConnection();
       if (conn != NULL)
@@ -5536,11 +5297,11 @@ void Node::checkOSPFSupport(SNMP_Transport *pTransport)
       lockProperties();
       if (nAdminStatus)
       {
-         m_flags |= NF_IS_OSPF;
+         m_capabilities |= NC_IS_OSPF;
       }
       else
       {
-         m_flags &= ~NF_IS_OSPF;
+         m_capabilities &= ~NC_IS_OSPF;
       }
       unlockProperties();
    }
@@ -5551,10 +5312,10 @@ void Node::checkOSPFSupport(SNMP_Transport *pTransport)
  */
 AgentConnectionEx *Node::createAgentConnection(bool sendServerId)
 {
-   if ((!(m_flags & NF_IS_NATIVE_AGENT)) ||
+   if ((!(m_capabilities & NC_IS_NATIVE_AGENT)) ||
        (m_flags & NF_DISABLE_NXCP) ||
-       (m_dwDynamicFlags & NDF_AGENT_UNREACHABLE) ||
-       (m_dwDynamicFlags & NDF_UNREACHABLE))
+       (m_state & NSF_AGENT_UNREACHABLE) ||
+       (m_state & NSF_UNREACHABLE))
       return NULL;
 
    AgentTunnel *tunnel = GetTunnelForNode(m_id);
@@ -5686,7 +5447,7 @@ void Node::changeIPAddress(const InetAddress& ipAddr)
          ipAddr.toString(m_primaryName);
 
       setPrimaryIPAddress(ipAddr);
-      m_dwDynamicFlags |= NDF_FORCE_CONFIGURATION_POLL | NDF_RECHECK_CAPABILITIES;
+      m_runtimeFlags |= DCDF_FORCE_CONFIGURATION_POLL | NDF_RECHECK_CAPABILITIES;
 
       // Change status of node and all it's children to UNKNOWN
       m_status = STATUS_UNKNOWN;
@@ -5727,7 +5488,7 @@ void Node::changeZone(UINT32 newZone)
 
    lockProperties();
    m_zoneUIN = newZone;
-   m_dwDynamicFlags |= NDF_FORCE_CONFIGURATION_POLL | NDF_RECHECK_CAPABILITIES;
+   m_runtimeFlags |= DCDF_FORCE_CONFIGURATION_POLL | NDF_RECHECK_CAPABILITIES;
    m_lastConfigurationPoll = 0;
    unlockProperties();
 
@@ -5804,7 +5565,7 @@ ROUTING_TABLE *Node::getRoutingTable()
 {
    ROUTING_TABLE *pRT = NULL;
 
-   if ((m_flags & NF_IS_NATIVE_AGENT) && (!(m_flags & NF_DISABLE_NXCP)))
+   if ((m_capabilities & NC_IS_NATIVE_AGENT) && (!(m_flags & NF_DISABLE_NXCP)))
    {
       agentLock();
       if (connectToAgent())
@@ -5813,14 +5574,14 @@ ROUTING_TABLE *Node::getRoutingTable()
       }
       agentUnlock();
    }
-   if ((pRT == NULL) && (m_flags & NF_IS_SNMP) && (!(m_flags & NF_DISABLE_SNMP)))
+   if ((pRT == NULL) && (m_flags & NC_IS_SNMP) && (!(m_flags & NF_DISABLE_SNMP)))
    {
       SNMP_Transport *pTransport;
 
       pTransport = createSnmpTransport();
       if (pTransport != NULL)
       {
-         pRT = SnmpGetRoutingTable(m_snmpVersion, pTransport);
+         pRT = SnmpGetRoutingTable(m_capabilities, pTransport);
          delete pTransport;
       }
    }
@@ -5982,9 +5743,9 @@ void Node::routingTablePoll(PollerInfo *poller)
  */
 void Node::updateRoutingTable()
 {
-   if (m_dwDynamicFlags & NDF_DELETE_IN_PROGRESS)
+   if (m_runtimeFlags & DCDF_DELETE_IN_PROGRESS)
    {
-      m_dwDynamicFlags &= ~NDF_QUEUED_FOR_ROUTE_POLL;
+      m_runtimeFlags &= ~NDF_QUEUED_FOR_ROUTE_POLL;
       return;
    }
 
@@ -6001,7 +5762,7 @@ void Node::updateRoutingTable()
       DbgPrintf(5, _T("Routing table updated for node %s [%d]"), m_name, m_id);
    }
    m_lastRTUpdate = time(NULL);
-   m_dwDynamicFlags &= ~NDF_QUEUED_FOR_ROUTE_POLL;
+   m_runtimeFlags &= ~NDF_QUEUED_FOR_ROUTE_POLL;
 }
 
 /**
@@ -6011,9 +5772,9 @@ UINT32 Node::callSnmpEnumerate(const TCHAR *pszRootOid,
                               UINT32 (* pHandler)(SNMP_Variable *, SNMP_Transport *, void *),
                               void *pArg, const TCHAR *context)
 {
-   if ((m_flags & NF_IS_SNMP) &&
-       (!(m_dwDynamicFlags & NDF_SNMP_UNREACHABLE)) &&
-       (!(m_dwDynamicFlags & NDF_UNREACHABLE)))
+   if ((m_capabilities & NC_IS_SNMP) &&
+       (!(m_state & NSF_SNMP_UNREACHABLE)) &&
+       (!(m_state & NSF_UNREACHABLE)))
    {
       SNMP_Transport *pTransport;
       UINT32 dwResult;
@@ -6082,7 +5843,7 @@ void Node::prepareForDeletion()
 {
    // Prevent node from being queued for polling
    lockProperties();
-   m_dwDynamicFlags |= NDF_POLLING_DISABLED | NDF_DELETE_IN_PROGRESS;
+   m_runtimeFlags |= DCDF_DELETE_IN_PROGRESS;
    unlockProperties();
 
    // Wait for all pending polls
@@ -6090,10 +5851,10 @@ void Node::prepareForDeletion()
    while(1)
    {
       lockProperties();
-      if ((m_dwDynamicFlags &
-            (NDF_QUEUED_FOR_STATUS_POLL | NDF_QUEUED_FOR_CONFIG_POLL |
+      if ((m_runtimeFlags &
+            (DCDF_QUEUED_FOR_STATUS_POLL | DCDF_QUEUED_FOR_CONFIGURATION_POLL |
              NDF_QUEUED_FOR_DISCOVERY_POLL | NDF_QUEUED_FOR_ROUTE_POLL |
-             NDF_QUEUED_FOR_TOPOLOGY_POLL | NDF_QUEUED_FOR_INSTANCE_POLL)) == 0)
+             NDF_QUEUED_FOR_TOPOLOGY_POLL | DCDF_QUEUED_FOR_INSTANCE_POLL)) == 0)
       {
          unlockProperties();
          break;
@@ -6486,10 +6247,10 @@ void Node::topologyPoll(PollerInfo *poller)
  */
 void Node::topologyPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller)
 {
-   if (m_dwDynamicFlags & NDF_DELETE_IN_PROGRESS)
+   if (m_runtimeFlags & DCDF_DELETE_IN_PROGRESS)
    {
       if (dwRqId == 0)
-         m_dwDynamicFlags &= ~NDF_QUEUED_FOR_TOPOLOGY_POLL;
+         m_runtimeFlags &= ~NDF_QUEUED_FOR_TOPOLOGY_POLL;
       return;
    }
 
@@ -6539,9 +6300,9 @@ void Node::topologyPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poll
          lockProperties();
          UINT32 oldFlags = m_flags;
          if (vlanList != NULL)
-            m_flags |= NF_HAS_VLANS;
+            m_capabilities |= NC_HAS_VLANS;
          else
-            m_flags &= ~NF_HAS_VLANS;
+            m_capabilities &= ~NC_HAS_VLANS;
          if (oldFlags != m_flags)
             setModified();
          unlockProperties();
@@ -6688,7 +6449,7 @@ void Node::topologyPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poll
    }
 
    // Read list of associated wireless stations
-   if ((m_driver != NULL) && (m_flags & NF_IS_WIFI_CONTROLLER))
+   if ((m_driver != NULL) && (m_capabilities & NC_IS_WIFI_CONTROLLER))
    {
       SNMP_Transport *snmp = createSnmpTransport();
       if (snmp != NULL)
@@ -6753,7 +6514,7 @@ void Node::topologyPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poll
    sendPollerMsg(dwRqId, _T("Finished topology poll for node %s\r\n"), m_name);
 
    m_lastTopologyPoll = time(NULL);
-   m_dwDynamicFlags &= ~NDF_QUEUED_FOR_TOPOLOGY_POLL;
+   m_runtimeFlags &= ~NDF_QUEUED_FOR_TOPOLOGY_POLL;
    pollerUnlock();
 
    DbgPrintf(4, _T("Finished topology poll for node %s [%d]"), m_name, m_id);
@@ -7562,36 +7323,11 @@ ComponentTree *Node::getComponents()
 }
 
 /**
- * Execute hook script
- *
- * @param hookName hook name. Will find and excute script named Hook::hookName
- */
-void Node::executeHookScript(const TCHAR *hookName)
-{
-   TCHAR scriptName[MAX_PATH] = _T("Hook::");
-   nx_strncpy(&scriptName[6], hookName, MAX_PATH - 6);
-   NXSL_VM *vm = CreateServerScriptVM(scriptName);
-   if (vm == NULL)
-   {
-      DbgPrintf(7, _T("Node::executeHookScript(%s [%u]): hook script \"%s\" not found"), m_name, m_id, scriptName);
-      return;
-   }
-
-   vm->setGlobalVariable(_T("$node"), new NXSL_Value(new NXSL_Object(&g_nxslNodeClass, this)));
-   if (!vm->run())
-   {
-      DbgPrintf(4, _T("Node::executeHookScript(%s [%u]): hook script \"%s\" execution error: %s"),
-                m_name, m_id, scriptName, vm->getErrorText());
-   }
-   delete vm;
-}
-
-/**
  * Check if data collection is disabled
  */
 bool Node::isDataCollectionDisabled()
 {
-   return (m_flags & NF_DISABLE_DATA_COLLECT) != 0;
+   return (m_flags & DCF_DISABLE_DATA_COLLECT) != 0;
 }
 
 /**
@@ -7872,14 +7608,14 @@ void Node::syncDataCollectionWithAgent(AgentConnectionEx *conn)
    if (rcc == ERR_SUCCESS)
    {
       DbgPrintf(4, _T("SyncDataCollection: node %s [%d] synchronized"), m_name, (int)m_id);
-      m_dwDynamicFlags &= ~NDF_CACHE_MODE_NOT_SUPPORTED;
+      m_state &= ~NSF_CACHE_MODE_NOT_SUPPORTED;
    }
    else
    {
       DbgPrintf(4, _T("SyncDataCollection: node %s [%d] not synchronized (%s)"), m_name, (int)m_id, AgentErrorCodeToText(rcc));
       if ((rcc == ERR_UNKNOWN_COMMAND) || (rcc == ERR_NOT_IMPLEMENTED))
       {
-         m_dwDynamicFlags |= NDF_CACHE_MODE_NOT_SUPPORTED;
+         m_state |= NSF_CACHE_MODE_NOT_SUPPORTED;
       }
    }
 }
@@ -7922,7 +7658,7 @@ void Node::onDataCollectionChangeAsyncCallback(void *arg)
 void Node::onDataCollectionChange()
 {
    DataCollectionTarget::onDataCollectionChange();
-   if (m_flags & NF_IS_NATIVE_AGENT)
+   if (m_capabilities & NC_IS_NATIVE_AGENT)
    {
       DbgPrintf(5, _T("Node::onDataCollectionChange(%s [%d]): executing data collection sync"), m_name, m_id);
       ThreadPoolExecute(g_mainThreadPool, Node::onDataCollectionChangeAsyncCallback, this);
@@ -8150,7 +7886,7 @@ json_t *Node::toJson()
    json_object_set_new(root, "ipAddress", m_ipAddress.toJson());
    json_object_set_new(root, "primaryName", json_string_t(m_primaryName));
    json_object_set_new(root, "tunnelId", m_tunnelId.toJson());
-   json_object_set_new(root, "runtimeFlags", json_integer(m_dwDynamicFlags));
+   json_object_set_new(root, "stateFlags", json_integer(m_state));
    json_object_set_new(root, "type", json_integer(m_type));
    json_object_set_new(root, "subType", json_string_t(m_subType));
    json_object_set_new(root, "iPendingStatus", json_integer(m_iPendingStatus));
index eaa255a..5007b7f 100644 (file)
@@ -165,7 +165,7 @@ Node NXCORE_EXPORTABLE *PollNewNode(const InetAddress& ipAddr, UINT32 creationFl
       dwFlags |= NF_DISABLE_SNMP;
    if (creationFlags & NXC_NCF_DISABLE_NXCP)
       dwFlags |= NF_DISABLE_NXCP;
-   pNode = new Node(ipAddr, dwFlags, agentProxyId, snmpProxyId, icmpProxyId, sshProxyId, zoneUIN);
+   pNode = new Node(ipAddr, dwFlags, 0, agentProxyId, snmpProxyId, icmpProxyId, sshProxyId, zoneUIN);
        if (agentPort != 0)
                pNode->setAgentPort(agentPort);
        if (snmpPort != 0)
index d129e19..0052389 100644 (file)
@@ -356,7 +356,7 @@ NXSL_METHOD_DEFINITION(Node, enableAgent)
  */
 NXSL_METHOD_DEFINITION(Node, enableConfigurationPolling)
 {
-   return ChangeFlagMethod(object, argv[0], result, NF_DISABLE_CONF_POLL);
+   return ChangeFlagMethod(object, argv[0], result, DCF_DISABLE_CONF_POLL);
 }
 
 /**
@@ -396,7 +396,7 @@ NXSL_METHOD_DEFINITION(Node, enableSnmp)
  */
 NXSL_METHOD_DEFINITION(Node, enableStatusPolling)
 {
-   return ChangeFlagMethod(object, argv[0], result, NF_DISABLE_STATUS_POLL);
+   return ChangeFlagMethod(object, argv[0], result, DCF_DISABLE_STATUS_POLL);
 }
 
 /**
@@ -461,15 +461,15 @@ NXSL_Value *NXSL_NodeClass::getAttr(NXSL_Object *object, const TCHAR *attr)
    }
    else if (!_tcscmp(attr, _T("isAgent")))
    {
-      value = new NXSL_Value((LONG)((node->getFlags() & NF_IS_NATIVE_AGENT) ? 1 : 0));
+      value = new NXSL_Value((LONG)((node->getCapabilities() & NC_IS_NATIVE_AGENT) ? 1 : 0));
    }
    else if (!_tcscmp(attr, _T("isBridge")))
    {
-      value = new NXSL_Value((LONG)((node->getFlags() & NF_IS_BRIDGE) ? 1 : 0));
+      value = new NXSL_Value((LONG)((node->getCapabilities() & NC_IS_BRIDGE) ? 1 : 0));
    }
    else if (!_tcscmp(attr, _T("isCDP")))
    {
-      value = new NXSL_Value((LONG)((node->getFlags() & NF_IS_CDP) ? 1 : 0));
+      value = new NXSL_Value((LONG)((node->getCapabilities() & NC_IS_CDP) ? 1 : 0));
    }
    else if (!_tcscmp(attr, _T("isInMaintenanceMode")))
    {
@@ -477,7 +477,7 @@ NXSL_Value *NXSL_NodeClass::getAttr(NXSL_Object *object, const TCHAR *attr)
    }
    else if (!_tcscmp(attr, _T("isLLDP")))
    {
-      value = new NXSL_Value((LONG)((node->getFlags() & NF_IS_LLDP) ? 1 : 0));
+      value = new NXSL_Value((LONG)((node->getCapabilities() & NC_IS_LLDP) ? 1 : 0));
    }
        else if (!_tcscmp(attr, _T("isLocalMgmt")) || !_tcscmp(attr, _T("isLocalManagement")))
        {
@@ -485,27 +485,27 @@ NXSL_Value *NXSL_NodeClass::getAttr(NXSL_Object *object, const TCHAR *attr)
        }
    else if (!_tcscmp(attr, _T("isPAE")) || !_tcscmp(attr, _T("is802_1x")))
    {
-      value = new NXSL_Value((LONG)((node->getFlags() & NF_IS_8021X) ? 1 : 0));
+      value = new NXSL_Value((LONG)((node->getCapabilities() & NC_IS_8021X) ? 1 : 0));
    }
    else if (!_tcscmp(attr, _T("isPrinter")))
    {
-      value = new NXSL_Value((LONG)((node->getFlags() & NF_IS_PRINTER) ? 1 : 0));
+      value = new NXSL_Value((LONG)((node->getCapabilities() & NC_IS_PRINTER) ? 1 : 0));
    }
    else if (!_tcscmp(attr, _T("isRouter")))
    {
-      value = new NXSL_Value((LONG)((node->getFlags() & NF_IS_ROUTER) ? 1 : 0));
+      value = new NXSL_Value((LONG)((node->getCapabilities() & NC_IS_ROUTER) ? 1 : 0));
    }
    else if (!_tcscmp(attr, _T("isSMCLP")))
    {
-      value = new NXSL_Value((LONG)((node->getFlags() & NF_IS_SMCLP) ? 1 : 0));
+      value = new NXSL_Value((LONG)((node->getCapabilities() & NC_IS_SMCLP) ? 1 : 0));
    }
    else if (!_tcscmp(attr, _T("isSNMP")))
    {
-      value = new NXSL_Value((LONG)((node->getFlags() & NF_IS_SNMP) ? 1 : 0));
+      value = new NXSL_Value((LONG)((node->getCapabilities() & NC_IS_SNMP) ? 1 : 0));
    }
    else if (!_tcscmp(attr, _T("isSONMP")))
    {
-      value = new NXSL_Value((LONG)((node->getFlags() & NF_IS_SONMP) ? 1 : 0));
+      value = new NXSL_Value((LONG)((node->getCapabilities() & NC_IS_NDP) ? 1 : 0));
    }
    else if (!_tcscmp(attr, _T("lastAgentCommTime")))
    {
index 1981dec..4a5cce3 100644 (file)
@@ -1189,7 +1189,7 @@ UINT32 FindUnusedZoneUIN()
  */
 static bool LocalMgmtNodeComparator(NetObj *object, void *data)
 {
-       return (((Node *)object)->getFlags() & NF_IS_LOCAL_MGMT) ? true : false;
+       return (((Node *)object)->getCapabilities() & NC_IS_LOCAL_MGMT) ? true : false;
 }
 
 /**
index 8ed2c73..70dd6da 100644 (file)
@@ -181,7 +181,7 @@ static THREAD_RESULT THREAD_CALL DeploymentThread(void *pArg)
       msg.setField(VID_OBJECT_ID, pNode->getId());
 
       // Check if node is a management server itself
-      if (!(pNode->getFlags() & NF_IS_LOCAL_MGMT))
+      if (!(pNode->getCapabilities() & NC_IS_LOCAL_MGMT))
       {
          // Change deployment status to "Initializing"
          msg.setField(VID_DEPLOYMENT_STATUS, (WORD)DEPLOYMENT_STATUS_INITIALIZE);
index a8724d5..73e1ecf 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
 ** NetXMS - Network Management System
 ** Copyright (C) 2003-2017 Victor Kirhenshtein
 **
@@ -74,7 +74,7 @@ static EnumerationCallbackResult ShowPollerInfo(const void *key, const void *obj
 
    TCHAR name[32];
    nx_strncpy(name, o->getName(), 31);
-   ConsolePrintf((CONSOLE_CTX)arg, _T("%s | %9d | %-30s | %s\n"), pollerType[p->getType()], o->getId(), name, p->getStatus()); 
+   ConsolePrintf((CONSOLE_CTX)arg, _T("%s | %9d | %-30s | %s\n"), pollerType[p->getType()], o->getId(), name, p->getStatus());
 
    return _CONTINUE;
 }
@@ -107,7 +107,7 @@ static void CreateManagementNode(const InetAddress& addr)
 {
        TCHAR buffer[256];
 
-       Node *node = new Node(addr, NF_IS_LOCAL_MGMT, 0, 0, 0, 0, 0);
+       Node *node = new Node(addr, 0, NC_IS_LOCAL_MGMT, 0, 0, 0, 0, 0);
    NetObjInsert(node, true, false);
        node->setName(GetLocalHostName(buffer, 256));
 
@@ -133,7 +133,7 @@ static void CheckMgmtFlagCallback(NetObj *object, void *data)
        if ((g_dwMgmtNode != object->getId()) && ((Node *)object)->isLocalManagement())
        {
                ((Node *)object)->clearLocalMgmtFlag();
-               DbgPrintf(2, _T("Incorrectly set flag NF_IS_LOCAL_MGMT cleared from node %s [%d]"),
+               DbgPrintf(2, _T("Incorrectly set flag NC_IS_LOCAL_MGMT cleared from node %s [%d]"),
                                         object->getName(), object->getId());
        }
 }
@@ -166,10 +166,10 @@ void CheckForMgmtNode()
          if ((node = FindNodeByIP(0, &iface->ipAddrList)) != NULL)
          {
             // Check management node flag
-            if (!(node->getFlags() & NF_IS_LOCAL_MGMT))
+            if (!(node->getFlags() & NC_IS_LOCAL_MGMT))
             {
                node->setLocalMgmtFlag();
-               DbgPrintf(1, _T("Local management node %s [%d] was not have NF_IS_LOCAL_MGMT flag set"), node->getName(), node->getId());
+               DbgPrintf(1, _T("Local management node %s [%d] was not have NC_IS_LOCAL_MGMT flag set"), node->getName(), node->getId());
             }
             g_dwMgmtNode = node->getId();   // Set local management node ID
             break;
@@ -201,7 +201,7 @@ void CheckForMgmtNode()
 
        if (g_dwMgmtNode != 0)
        {
-               // Check that other nodes does not have NF_IS_LOCAL_MGMT flag set
+               // Check that other nodes does not have NC_IS_LOCAL_MGMT flag set
                g_idxNodeById.forEach(CheckMgmtFlagCallback, NULL);
        }
        else
@@ -209,7 +209,7 @@ void CheckForMgmtNode()
                // Management node cannot be found or created. This can happen
                // if management node currently does not have IP addresses (for example,
                // it's a Windows machine which is disconnected from the network).
-               // In this case, try to find any node with NF_IS_LOCAL_MGMT flag, or create
+               // In this case, try to find any node with NC_IS_LOCAL_MGMT flag, or create
                // new one without interfaces
                NetObj *mgmtNode = g_idxNodeById.find(LocalMgmtNodeComparator, NULL);
                if (mgmtNode != NULL)
@@ -403,7 +403,7 @@ static void DiscoveryPoller(void *arg)
    }
 
    Node *node = (Node *)poller->getObject();
-       if (node->getRuntimeFlags() & NDF_DELETE_IN_PROGRESS)
+       if (node->getRuntimeFlags() & DCDF_DELETE_IN_PROGRESS)
        {
       node->setDiscoveryPollTimeStamp();
       delete poller;
@@ -483,7 +483,7 @@ static void CheckRange(const InetAddressListElement& range)
             pSubnet = FindSubnetForNode(0, addr);
             if (pSubnet != NULL)
             {
-               if (!pSubnet->getIpAddress().equals(addr) && 
+               if (!pSubnet->getIpAddress().equals(addr) &&
                    !addr.isSubnetBroadcast(pSubnet->getIpAddress().getMaskBits()))
                {
                   NEW_NODE *pInfo;
@@ -555,47 +555,34 @@ static void QueueForPolling(NetObj *object, void *data)
    WatchdogNotify(*((UINT32 *)data));
    if (IsShutdownInProgress())
       return;
+   if(object->isDataCollectionTarget()) //common check for node, cluster and sensor
+   {
+      DataCollectionTarget *target = (DataCollectionTarget *)object;
+      if (target->isReadyForStatusPoll())
+      {
+         target->lockForStatusPoll();
+         DbgPrintf(6, _T("Data Collection Target %d \"%s\" queued for status poll"), (int)target->getId(), target->getName());
+         ThreadPoolExecute(g_pollerThreadPool, target, &DataCollectionTarget::statusPoll, RegisterPoller(POLLER_TYPE_STATUS, target));
+      }
+      if (target->isReadyForConfigurationPoll())
+      {
+         target->lockForConfigurationPoll();
+         DbgPrintf(6, _T("Data Collection Target %d \"%s\" queued for configuration poll"), (int)target->getId(), target->getName());
+         ThreadPoolExecute(g_pollerThreadPool, target, &DataCollectionTarget::configurationPoll, RegisterPoller(POLLER_TYPE_CONFIGURATION, target));
+      }
+      if (target->isReadyForInstancePoll())
+      {
+         target->lockForInstancePoll();
+         DbgPrintf(6, _T("Data Collection Target %d \"%s\" queued for instance discovery poll"), (int)target->getId(), target->getName());
+         ThreadPoolExecute(g_pollerThreadPool, target, &DataCollectionTarget::instanceDiscoveryPoll, RegisterPoller(POLLER_TYPE_INSTANCE_DISCOVERY, target));
+      }
+   }
 
        switch(object->getObjectClass())
        {
-          case OBJECT_SENSOR:
-         {
-            Sensor *sensor = (Sensor *)object;
-            if (sensor->isReadyForStatusPoll())
-            {
-               sensor->lockForStatusPoll();
-               DbgPrintf(6, _T("Sensor %d \"%s\" queued for status poll"), (int)sensor->getId(), sensor->getName());
-               ThreadPoolExecute(g_pollerThreadPool, sensor, &Sensor::statusPoll, RegisterPoller(POLLER_TYPE_STATUS, sensor));
-            }
-            if (sensor->isReadyForConfigurationPoll())
-            {
-               sensor->lockForConfigurationPoll();
-               DbgPrintf(6, _T("Sensor %d \"%s\" queued for configuration poll"), (int)sensor->getId(), sensor->getName());
-               ThreadPoolExecute(g_pollerThreadPool, sensor, &Sensor::configurationPoll, RegisterPoller(POLLER_TYPE_CONFIGURATION, sensor));
-            }
-            break;
-         }
                case OBJECT_NODE:
                        {
                                Node *node = (Node *)object;
-                               if (node->isReadyForConfigurationPoll())
-                               {
-                                       node->lockForConfigurationPoll();
-                                       DbgPrintf(6, _T("Node %d \"%s\" queued for configuration poll"), (int)node->getId(), node->getName());
-               ThreadPoolExecute(g_pollerThreadPool, node, &Node::configurationPoll, RegisterPoller(POLLER_TYPE_CONFIGURATION, node));
-                               }
-                               if (node->isReadyForInstancePoll())
-                               {
-                                       node->lockForInstancePoll();
-                                       DbgPrintf(6, _T("Node %d \"%s\" queued for instance discovery poll"), (int)node->getId(), node->getName());
-               ThreadPoolExecute(g_pollerThreadPool, node, &Node::instanceDiscoveryPoll, RegisterPoller(POLLER_TYPE_INSTANCE_DISCOVERY, node));
-                               }
-                               if (node->isReadyForStatusPoll())
-                               {
-                                       node->lockForStatusPoll();
-                                       DbgPrintf(6, _T("Node %d \"%s\" queued for status poll"), (int)node->getId(), node->getName());
-               ThreadPoolExecute(g_pollerThreadPool, node, &Node::statusPoll, RegisterPoller(POLLER_TYPE_STATUS, node));
-                               }
                                if (node->isReadyForRoutePoll())
                                {
                                        node->lockForRoutePoll();
@@ -627,23 +614,6 @@ static void QueueForPolling(NetObj *object, void *data)
                                }
                        }
                        break;
-               case OBJECT_CLUSTER:
-                       {
-                               Cluster *cluster = (Cluster *)object;
-                               if (cluster->isReadyForStatusPoll())
-                               {
-                                       cluster->lockForStatusPoll();
-                                       DbgPrintf(6, _T("Cluster %d \"%s\" queued for status poll"), (int)cluster->getId(), cluster->getName());
-               ThreadPoolExecute(g_pollerThreadPool, cluster, &Cluster::statusPoll, RegisterPoller(POLLER_TYPE_STATUS, cluster));
-                               }
-            if (cluster->isReadyForConfigurationPoll())
-            {
-               cluster->lockForConfigurationPoll();
-               DbgPrintf(6, _T("Cluster %d \"%s\" queued for configuration poll"), (int)cluster->getId(), cluster->getName());
-               ThreadPoolExecute(g_pollerThreadPool, cluster, &Cluster::configurationPoll, RegisterPoller(POLLER_TYPE_CONFIGURATION, cluster));
-            }
-                       }
-                       break;
                case OBJECT_BUSINESSSERVICE:
                        {
                                BusinessService *service = (BusinessService *)object;
@@ -686,7 +656,7 @@ THREAD_RESULT THREAD_CALL PollManager(void *pArg)
          CheckForMgmtNode();
       }
 
-      // Walk through objects and queue them for status 
+      // Walk through objects and queue them for status
       // and/or configuration poll
                g_idxObjectById.forEach(QueueForPolling, &watchdogId);
           WatchdogStartSleep(watchdogId);
index b7f5833..c16a7ca 100644 (file)
@@ -44,8 +44,6 @@ Sensor::Sensor() : DataCollectionTarget()
    m_frequency = 0; //*10 from origin number
    m_lastStatusPoll = 0;
    m_lastConfigurationPoll = 0;
-   m_dwDynamicFlags = 0;
-   m_hPollerMutex = MutexCreate();
    m_status = STATUS_UNKNOWN;
 }
 
@@ -75,8 +73,6 @@ Sensor::Sensor(TCHAR *name, UINT32 flags, MacAddress macAddress, UINT32 deviceCl
    m_frequency = 0; //*10 from origin number
    m_lastStatusPoll = 0;
    m_lastConfigurationPoll = 0;
-   m_dwDynamicFlags = 0;
-   m_hPollerMutex = MutexCreate();
    m_status = STATUS_UNKNOWN;
 }
 
@@ -107,7 +103,7 @@ Sensor *Sensor::createSensor(TCHAR *name, NXCPMessage *request)
          }
          break;
       case COMM_DLMS:
-         sensor->m_flags = SENSOR_PROVISIONED | SENSOR_REGISTERED | SENSOR_ACTIVE;
+         sensor->m_state = SSF_PROVISIONED | SSF_REGISTERED | SSF_ACTIVE;
          break;
    }
    return sensor;
@@ -134,12 +130,10 @@ AgentConnectionEx *Sensor::getAgentConnection()
  */
 Sensor *Sensor::registerLoraDevice(Sensor *sensor)
 {
-/*
-   NetObj *proxy = FindObjectById(m_proxyNodeId, OBJECT_NODE);
+   NetObj *proxy = FindObjectById(sensor->m_proxyNodeId, OBJECT_NODE);
    if(proxy == NULL)
-      reutn NULL;
-   }
-   */
+      return NULL;
+
    AgentConnectionEx *conn = sensor->getAgentConnection();
    if (conn == NULL)
    {
@@ -185,8 +179,11 @@ Sensor *Sensor::registerLoraDevice(Sensor *sensor)
    if (response != NULL)
    {
       if(response->getFieldAsUInt32(VID_RCC) == RCC_SUCCESS)
+      {
+         sensor->lockProperties();
          sensor->setProvisoned();
-
+         sensor->unlockProperties();
+      }
       delete response;
    }
 
@@ -209,7 +206,6 @@ Sensor::~Sensor()
    free(m_deviceAddress);
    free(m_metaType);
    free(m_description);
-   MutexDestroy(m_hPollerMutex);
 }
 
 /**
@@ -226,31 +222,28 @@ bool Sensor::loadFromDatabase(DB_HANDLE hdb, UINT32 id)
    }
 
        TCHAR query[512];
-       _sntprintf(query, 512, _T("SELECT flags,mac_address,device_class,vendor,communication_protocol,xml_config,serial_number,device_address,")
-                          _T("meta_type,description,last_connection_time,frame_count,signal_strenght,signal_noise,frequency,proxy_node,xml_reg_config,runtime_flags FROM sensors WHERE id=%d"), m_id);
+       _sntprintf(query, 512, _T("SELECT mac_address,device_class,vendor,communication_protocol,xml_config,serial_number,device_address,")
+                          _T("meta_type,description,last_connection_time,frame_count,signal_strenght,signal_noise,frequency,proxy_node,xml_reg_config FROM sensors WHERE id=%d"), m_id);
        DB_RESULT hResult = DBSelect(hdb, query);
        if (hResult == NULL)
                return false;
 
-   m_flags = DBGetFieldULong(hResult, 0, 0);
-   m_macAddress = DBGetFieldMacAddr(hResult, 0, 1);
-       m_deviceClass = DBGetFieldULong(hResult, 0, 2);
-       m_vendor = DBGetField(hResult, 0, 3, NULL, 0);
-       m_commProtocol = DBGetFieldULong(hResult, 0, 4);
-       m_xmlConfig = DBGetField(hResult, 0, 5, NULL, 0);
-       m_serialNumber = DBGetField(hResult, 0, 6, NULL, 0);
-       m_deviceAddress = DBGetField(hResult, 0, 7, NULL, 0);
-       m_metaType = DBGetField(hResult, 0, 8, NULL, 0);
-       m_description = DBGetField(hResult, 0, 9, NULL, 0);
-   m_lastConnectionTime = DBGetFieldULong(hResult, 0, 10);
-   m_frameCount = DBGetFieldULong(hResult, 0, 11);
-   m_signalStrenght = DBGetFieldLong(hResult, 0, 12);
-   m_signalNoise = DBGetFieldLong(hResult, 0, 13);
-   m_frequency = DBGetFieldLong(hResult, 0, 14);
-   m_proxyNodeId = DBGetFieldLong(hResult, 0, 15);
-   m_xmlRegConfig = DBGetField(hResult, 0, 16, NULL, 0);
-   m_dwDynamicFlags = DBGetFieldULong(hResult, 0, 17);
-   m_dwDynamicFlags &= NDF_PERSISTENT; // Clear out all non-persistent runtime flags
+   m_macAddress = DBGetFieldMacAddr(hResult, 0, 0);
+       m_deviceClass = DBGetFieldULong(hResult, 0, 1);
+       m_vendor = DBGetField(hResult, 0, 2, NULL, 0);
+       m_commProtocol = DBGetFieldULong(hResult, 0, 3);
+       m_xmlConfig = DBGetField(hResult, 0, 4, NULL, 0);
+       m_serialNumber = DBGetField(hResult, 0, 5, NULL, 0);
+       m_deviceAddress = DBGetField(hResult, 0, 6, NULL, 0);
+       m_metaType = DBGetField(hResult, 0, 7, NULL, 0);
+       m_description = DBGetField(hResult, 0, 8, NULL, 0);
+   m_lastConnectionTime = DBGetFieldULong(hResult, 0, 9);
+   m_frameCount = DBGetFieldULong(hResult, 0, 10);
+   m_signalStrenght = DBGetFieldLong(hResult, 0, 11);
+   m_signalNoise = DBGetFieldLong(hResult, 0, 12);
+   m_frequency = DBGetFieldLong(hResult, 0, 13);
+   m_proxyNodeId = DBGetFieldLong(hResult, 0, 14);
+   m_xmlRegConfig = DBGetField(hResult, 0, 15, NULL, 0);
    DBFreeResult(hResult);
 
    // Load DCI and access list
@@ -277,31 +270,29 @@ BOOL Sensor::saveToDatabase(DB_HANDLE hdb)
       DB_STATEMENT hStmt;
       bool isNew = !(IsDatabaseRecordExist(hdb, _T("sensors"), _T("id"), m_id));
       if (isNew)
-         hStmt = DBPrepare(hdb, _T("INSERT INTO sensors (flags,mac_address,device_class,vendor,communication_protocol,xml_config,serial_number,device_address,meta_type,description,last_connection_time,frame_count,signal_strenght,signal_noise,frequency,proxy_node,runtime_flags,id,xml_reg_config) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"));
+         hStmt = DBPrepare(hdb, _T("INSERT INTO sensors (mac_address,device_class,vendor,communication_protocol,xml_config,serial_number,device_address,meta_type,description,last_connection_time,frame_count,signal_strenght,signal_noise,frequency,proxy_node,id,xml_reg_config) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"));
       else
-         hStmt = DBPrepare(hdb, _T("UPDATE sensors SET flags=?,mac_address=?,device_class=?,vendor=?,communication_protocol=?,xml_config=?,serial_number=?,device_address=?,meta_type=?,description=?,last_connection_time=?,frame_count=?,signal_strenght=?,signal_noise=?,frequency=?,proxy_node=?,runtime_flags=? WHERE id=?"));
+         hStmt = DBPrepare(hdb, _T("UPDATE sensors SET mac_address=?,device_class=?,vendor=?,communication_protocol=?,xml_config=?,serial_number=?,device_address=?,meta_type=?,description=?,last_connection_time=?,frame_count=?,signal_strenght=?,signal_noise=?,frequency=?,proxy_node=? WHERE id=?"));
       if (hStmt != NULL)
       {
-         DBBind(hStmt, 1, DB_SQLTYPE_INTEGER, m_flags);
-         DBBind(hStmt, 2, DB_SQLTYPE_VARCHAR, m_macAddress);
-         DBBind(hStmt, 3, DB_SQLTYPE_INTEGER, (INT32)m_deviceClass);
-         DBBind(hStmt, 4, DB_SQLTYPE_VARCHAR, m_vendor, DB_BIND_STATIC);
-         DBBind(hStmt, 5, DB_SQLTYPE_INTEGER, (INT32)m_commProtocol);
-         DBBind(hStmt, 6, DB_SQLTYPE_VARCHAR, m_xmlConfig, DB_BIND_STATIC);
-         DBBind(hStmt, 7, DB_SQLTYPE_VARCHAR, m_serialNumber, DB_BIND_STATIC);
-         DBBind(hStmt, 8, DB_SQLTYPE_VARCHAR, m_deviceAddress, DB_BIND_STATIC);
-         DBBind(hStmt, 9, DB_SQLTYPE_VARCHAR, m_metaType, DB_BIND_STATIC);
-         DBBind(hStmt, 10, DB_SQLTYPE_VARCHAR, m_description, DB_BIND_STATIC);
-         DBBind(hStmt, 11, DB_SQLTYPE_INTEGER, (UINT32)m_lastConnectionTime);
-         DBBind(hStmt, 12, DB_SQLTYPE_INTEGER, m_frameCount);
-         DBBind(hStmt, 13, DB_SQLTYPE_INTEGER, m_signalStrenght);
-         DBBind(hStmt, 14, DB_SQLTYPE_INTEGER, m_signalNoise);
-         DBBind(hStmt, 15, DB_SQLTYPE_INTEGER, m_frequency);
-         DBBind(hStmt, 16, DB_SQLTYPE_INTEGER, m_proxyNodeId);
-         DBBind(hStmt, 17, DB_SQLTYPE_INTEGER, m_dwDynamicFlags);
-         DBBind(hStmt, 18, DB_SQLTYPE_INTEGER, m_id);
+         DBBind(hStmt, 1, DB_SQLTYPE_VARCHAR, m_macAddress);
+         DBBind(hStmt, 2, DB_SQLTYPE_INTEGER, (INT32)m_deviceClass);
+         DBBind(hStmt, 3, DB_SQLTYPE_VARCHAR, m_vendor, DB_BIND_STATIC);
+         DBBind(hStmt, 4, DB_SQLTYPE_INTEGER, (INT32)m_commProtocol);
+         DBBind(hStmt, 5, DB_SQLTYPE_VARCHAR, m_xmlConfig, DB_BIND_STATIC);
+         DBBind(hStmt, 6, DB_SQLTYPE_VARCHAR, m_serialNumber, DB_BIND_STATIC);
+         DBBind(hStmt, 7, DB_SQLTYPE_VARCHAR, m_deviceAddress, DB_BIND_STATIC);
+         DBBind(hStmt, 8, DB_SQLTYPE_VARCHAR, m_metaType, DB_BIND_STATIC);
+         DBBind(hStmt, 9, DB_SQLTYPE_VARCHAR, m_description, DB_BIND_STATIC);
+         DBBind(hStmt, 10, DB_SQLTYPE_INTEGER, (UINT32)m_lastConnectionTime);
+         DBBind(hStmt, 11, DB_SQLTYPE_INTEGER, m_frameCount);
+         DBBind(hStmt, 12, DB_SQLTYPE_INTEGER, m_signalStrenght);
+         DBBind(hStmt, 13, DB_SQLTYPE_INTEGER, m_signalNoise);
+         DBBind(hStmt, 14, DB_SQLTYPE_INTEGER, m_frequency);
+         DBBind(hStmt, 15, DB_SQLTYPE_INTEGER, m_proxyNodeId);
+         DBBind(hStmt, 16, DB_SQLTYPE_INTEGER, m_id);
          if(isNew)
-            DBBind(hStmt, 19, DB_SQLTYPE_VARCHAR, m_xmlRegConfig, DB_BIND_STATIC);
+            DBBind(hStmt, 17, DB_SQLTYPE_VARCHAR, m_xmlRegConfig, DB_BIND_STATIC);
 
          success = DBExecute(hStmt);
 
@@ -397,6 +388,9 @@ void Sensor::fillMessageInternal(NXCPMessage *msg)
 
 UINT32 Sensor::modifyFromMessageInternal(NXCPMessage *request)
 {
+   if (request->isFieldExist(VID_FLAGS))
+      m_flags = request->getFieldAsUInt32(VID_FLAGS);
+
    if (request->isFieldExist(VID_MAC_ADDR))
       m_macAddress = request->getFieldAsMacAddress(VID_MAC_ADDR);
    if (request->isFieldExist(VID_VENDOR))
@@ -440,37 +434,106 @@ UINT32 Sensor::modifyFromMessageInternal(NXCPMessage *request)
 /**
  * Calculate sensor status
  */
-void Sensor::calculateStatus()
+void Sensor::calculateCompoundStatus(BOOL bForcedRecalc)
+{
+   UINT32 oldStatus = m_status;
+   calculateStatus(bForcedRecalc);
+   lockProperties();
+   if (oldStatus != m_status)
+      setModified(true);
+   unlockProperties();
+}
+
+void Sensor::calculateStatus(BOOL bForcedRecalc)
 {
-   if (m_flags == 0 || m_flags == SENSOR_PROVISIONED)
+   AgentConnectionEx *conn = getAgentConnection();
+   if (conn == NULL)
+   {
       m_status = STATUS_UNKNOWN;
-   else if (m_flags & SENSOR_ACTIVE)
-      m_status = STATUS_NORMAL;
-   else if (m_flags & ~SENSOR_ACTIVE)
-      m_status = STATUS_CRITICAL;
+      return;
+   }
+   DataCollectionTarget::calculateCompoundStatus(bForcedRecalc);
+   lockProperties();
+   int status = 0;
+   if (m_state == 0 || m_state == SSF_PROVISIONED)
+      status = STATUS_UNKNOWN;
+   else if (m_state & SSF_ACTIVE)
+      status = STATUS_NORMAL;
+   else
+      status = STATUS_CRITICAL;
+
+   m_status = m_status != STATUS_UNKNOWN ? max(m_status, status) : status;
+   unlockProperties();
 }
 
 /**
- * Entry point for configuration poller
+ * Get instances for instance discovery DCO
  */
-void Sensor::configurationPoll(PollerInfo *poller)
+StringMap *Sensor::getInstanceList(DCObject *dco)
 {
-   poller->startExecution();
-   ObjectTransactionStart();
-   configurationPoll(NULL, 0, poller, 0);
-   ObjectTransactionEnd();
-   delete poller;
+   if (dco->getInstanceDiscoveryData() == NULL)
+      return NULL;
+
+   DataCollectionTarget *obj;
+   if (dco->getSourceNode() != 0)
+   {
+      obj = (DataCollectionTarget *)FindObjectById(dco->getSourceNode(), OBJECT_NODE);
+      if (obj == NULL)
+      {
+         DbgPrintf(6, _T("Sensor::getInstanceList(%s [%d]): source node [%d] not found"), dco->getName(), dco->getId(), dco->getSourceNode());
+         return NULL;
+      }
+      if (!obj->isTrustedNode(m_id))
+      {
+         DbgPrintf(6, _T("Sensor::getInstanceList(%s [%d]): this node (%s [%d]) is not trusted by source sensor %s [%d]"),
+                  dco->getName(), dco->getId(), m_name, m_id, obj->getName(), obj->getId());
+         return NULL;
+      }
+   }
+   else
+   {
+      obj = this;
+   }
+
+   StringList *instances = NULL;
+   StringMap *instanceMap = NULL;
+   switch(dco->getInstanceDiscoveryMethod())
+   {
+      case IDM_AGENT_LIST:
+         if (obj->getObjectClass() == OBJECT_NODE)
+            ((Node *)obj)->getListFromAgent(dco->getInstanceDiscoveryData(), &instances);
+         else if (obj->getObjectClass() == OBJECT_SENSOR)
+            ((Sensor *)obj)->getListFromAgent(dco->getInstanceDiscoveryData(), &instances);
+         break;
+      case IDM_SCRIPT:
+         obj->getStringMapFromScript(dco->getInstanceDiscoveryData(), &instanceMap, this);
+         break;
+      default:
+         instances = NULL;
+         break;
+   }
+   if ((instances == NULL) && (instanceMap == NULL))
+      return NULL;
+
+   if (instanceMap == NULL)
+   {
+      instanceMap = new StringMap;
+      for(int i = 0; i < instances->size(); i++)
+         instanceMap->set(instances->get(i), instances->get(i));
+   }
+   delete instances;
+   return instanceMap;
 }
 
 /**
  * Perform configuration poll on node
  */
-void Sensor::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller, int maskBits)
+void Sensor::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller)
 {
-   if (m_dwDynamicFlags & NDF_DELETE_IN_PROGRESS)
+   if (m_runtimeFlags & DCDF_DELETE_IN_PROGRESS)
    {
       if (dwRqId == 0)
-         m_dwDynamicFlags &= ~NDF_QUEUED_FOR_CONFIG_POLL;
+         m_runtimeFlags &= ~DCDF_QUEUED_FOR_CONFIGURATION_POLL;
       return;
    }
 
@@ -483,21 +546,22 @@ void Sensor::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInf
       return;
    }
 
+   m_pollRequestor = pSession;
    nxlog_debug(5, _T("Starting configuration poll for sensor %s (ID: %d), m_flags: %d"), m_name, m_id, m_flags);
 
    bool hasChanges = false;
 
    if(m_commProtocol == COMM_LORAWAN)
    {
-      if (!(m_flags & SENSOR_PROVISIONED))
+      if (!(m_state & SSF_PROVISIONED))
       {
-         if ((registerLoraDevice(this) != NULL) && (m_flags & SENSOR_PROVISIONED))
+         if ((registerLoraDevice(this) != NULL) && (m_state & SSF_PROVISIONED))
          {
             nxlog_debug(6, _T("ConfPoll(%s [%d}): sensor successfully registered"), m_name, m_id);
             hasChanges = true;
          }
       }
-      if ((m_flags & SENSOR_PROVISIONED) && (m_deviceAddress == NULL))
+      if ((m_state & SSF_PROVISIONED) && (m_deviceAddress == NULL))
       {
          getItemFromAgent(_T("LoraWAN.DevAddr(*)"), 0, m_deviceAddress);
          if (m_deviceAddress != NULL)
@@ -508,10 +572,18 @@ void Sensor::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInf
       }
    }
 
-   poller->setStatus(_T("cleanup"));
+   applyUserTemplates();
+   updateContainerMembership();
+
+   // Execute hook script
+   poller->setStatus(_T("hook"));
+   executeHookScript(_T("ConfigurationPoll"));
+
+   sendPollerMsg(dwRqId, _T("Finished configuration poll for sensor %s\r\n"), m_name);
+   sendPollerMsg(dwRqId, _T("Sensor configuration was%schanged after poll\r\n"), hasChanges ? _T(" ") : _T(" not "));
+
    if (dwRqId == 0)
-      m_dwDynamicFlags &= ~NDF_QUEUED_FOR_CONFIG_POLL;
-   m_dwDynamicFlags &= ~NDF_RECHECK_CAPABILITIES;
+      m_runtimeFlags &= ~DCDF_QUEUED_FOR_CONFIGURATION_POLL;
    m_lastConfigurationPoll = time(NULL);
 
    nxlog_debug(5, _T("Finished configuration poll for sensor %s (ID: %d)"), m_name, m_id);
@@ -523,17 +595,8 @@ void Sensor::configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInf
       setModified();
       unlockProperties();
    }
-}
-
-/**
- * Status poller entry point
- */
-void Sensor::statusPoll(PollerInfo *poller)
-{
-   poller->startExecution();
-   statusPoll(NULL, 0, poller);
 
-   delete poller;
+   m_runtimeFlags |= DCDF_CONFIGURATION_POLL_PASSED;
 }
 
 void Sensor::checkDlmsConverterAccessability()
@@ -546,10 +609,10 @@ void Sensor::checkDlmsConverterAccessability()
  */
 void Sensor::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller)
 {
-   if (m_dwDynamicFlags & NDF_DELETE_IN_PROGRESS)
+   if (m_runtimeFlags & DCDF_DELETE_IN_PROGRESS)
    {
       if (dwRqId == 0)
-         m_dwDynamicFlags &= ~NDF_QUEUED_FOR_STATUS_POLL;
+         m_runtimeFlags &= ~DCDF_QUEUED_FOR_STATUS_POLL;
       return;
    }
 
@@ -565,6 +628,7 @@ void Sensor::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poll
       return;
    }
 
+   m_pollRequestor = pSession;
    sendPollerMsg(dwRqId, _T("Starting status poll for sensor %s\r\n"), m_name);
    nxlog_debug(5, _T("Starting status poll for sensor %s (ID: %d)"), m_name, m_id);
 
@@ -573,12 +637,13 @@ void Sensor::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poll
    sendPollerMsg(dwRqId, _T("Checking NetXMS agent connectivity\r\n"));
 
    AgentConnectionEx *conn = getAgentConnection();
+   lockProperties();
    if (conn != NULL)
    {
       nxlog_debug(6, _T("StatusPoll(%s): connected to agent"), m_name);
-      if (m_dwDynamicFlags & NDF_AGENT_UNREACHABLE)
+      if (m_state & SSF_AGENT_UNREACHABLE)
       {
-         m_dwDynamicFlags &= ~NDF_AGENT_UNREACHABLE;
+         m_state &= ~SSF_AGENT_UNREACHABLE;
          sendPollerMsg(dwRqId, POLLER_INFO _T("Connectivity with NetXMS agent restored\r\n"));
       }
    }
@@ -586,16 +651,18 @@ void Sensor::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poll
    {
       nxlog_debug(6, _T("StatusPoll(%s): agent unreachable"), m_name);
       sendPollerMsg(dwRqId, POLLER_ERROR _T("NetXMS agent unreachable\r\n"));
-      if (!(m_dwDynamicFlags & NDF_AGENT_UNREACHABLE))
-         m_dwDynamicFlags |= NDF_AGENT_UNREACHABLE;
+      if (!(m_state & SSF_AGENT_UNREACHABLE))
+         m_state |= SSF_AGENT_UNREACHABLE;
    }
+   unlockProperties();
    nxlog_debug(6, _T("StatusPoll(%s): agent check finished"), m_name);
 
    switch(m_commProtocol)
    {
       case COMM_LORAWAN:
-         if (m_flags & SENSOR_PROVISIONED)
+         if (m_runtimeFlags & SSF_PROVISIONED)
          {
+            lockProperties();
             TCHAR lastValue[MAX_DCI_STRING_VALUE] = { 0 };
             time_t now;
             getItemFromAgent(_T("LoraWAN.LastContact(*)"), MAX_DCI_STRING_VALUE, lastValue);
@@ -608,24 +675,24 @@ void Sensor::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poll
 
             now = time(NULL);
 
-            if (!(m_flags & SENSOR_REGISTERED))
+            if (!(m_state & SSF_REGISTERED))
             {
                if (m_lastConnectionTime > 0)
                {
-                  m_flags |= SENSOR_REGISTERED;
+                  m_state |= SSF_REGISTERED;
                   nxlog_debug(6, _T("StatusPoll(%s [%d}): Status set to REGISTERED"), m_name, m_id);
                }
             }
-            if (m_flags & SENSOR_REGISTERED)
+            if (m_state & SSF_REGISTERED)
             {
                if (now - m_lastConnectionTime > 3600) // Last contact > 1h
                {
-                  m_flags &= ~SENSOR_ACTIVE;
+                  m_state &= ~SSF_ACTIVE;
                   nxlog_debug(6, _T("StatusPoll(%s [%d}): Inactive for over 1h, status set to INACTIVE"), m_name, m_id);
                }
                else
                {
-                  m_flags |= SENSOR_ACTIVE;
+                  m_state |= SSF_ACTIVE;
                   nxlog_debug(6, _T("StatusPoll(%s [%d}): Status set to ACTIVE"), m_name, m_id);
                   getItemFromAgent(_T("LoraWAN.RSSI(*)"), MAX_DCI_STRING_VALUE, lastValue);
                   m_signalStrenght = _tcstod(lastValue, NULL);
@@ -636,8 +703,6 @@ void Sensor::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poll
                }
             }
 
-            lockProperties();
-            calculateStatus();
             setModified();
             unlockProperties();
          }
@@ -645,14 +710,13 @@ void Sensor::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poll
       case COMM_DLMS:
          checkDlmsConverterAccessability();
          lockProperties();
-         calculateStatus();
          setModified();
          unlockProperties();
          break;
       default:
          break;
    }
-
+   calculateStatus(TRUE);
 
    // Send delayed events and destroy delayed event queue
    if (pQueue != NULL)
@@ -660,15 +724,36 @@ void Sensor::statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poll
       ResendEvents(pQueue);
       delete pQueue;
    }
+   poller->setStatus(_T("hook"));
+   executeHookScript(_T("StatusPoll"));
 
    if (dwRqId == 0)
-      m_dwDynamicFlags &= ~NDF_QUEUED_FOR_STATUS_POLL;
+      m_runtimeFlags &= ~DCDF_QUEUED_FOR_STATUS_POLL;
+
+   sendPollerMsg(dwRqId, _T("Finished status poll for sensor %s\r\n"), m_name);
+   sendPollerMsg(dwRqId, _T("Sensor status after poll is %s\r\n"), GetStatusAsText(m_status, true));
 
    pollerUnlock();
    m_lastStatusPoll = time(NULL);
    nxlog_debug(5, _T("Finished status poll for sensor %s (ID: %d)"), m_name, m_id);
 }
 
+void Sensor::prepareLoraDciParameters(String &parameter)
+{
+   int place = parameter.find(_T(")"));
+   if(place > 0)
+   {
+      parameter.replace(_T(")"), m_guid.toString());
+      parameter.append(_T(")"));
+   }
+   else
+   {
+      parameter.append(_T("("));
+      parameter.append(m_guid.toString());
+      parameter.append(_T(")"));
+   }
+}
+
 /**
  * Set all required parameters for DLMS request
  */
@@ -685,8 +770,16 @@ void Sensor::prepareDlmsDciParameters(String &parameter)
    ConfigEntry *configRoot = config.getEntry(_T("/connections"));
        if (configRoot != NULL)
        {
-               ObjectArray<ConfigEntry> *credentials = configRoot->getSubEntries(_T("/cred"));
-      parameter.replace(_T(")"), _T(""));
+          int place = parameter.find(_T(")"));
+          if(place > 0)
+          {
+             parameter.replace(_T(")"), _T(""));
+          }
+          else
+          {
+             parameter.append(_T("("));
+          }
+      ObjectArray<ConfigEntry> *credentials = configRoot->getSubEntries(_T("/cred"));
                for(int i = 0; i < credentials->size(); i++)
                {
                        ConfigEntry *cred = credentials->get(i);
@@ -734,7 +827,7 @@ void Sensor::prepareDlmsDciParameters(String &parameter)
  */
 UINT32 Sensor::getItemFromAgent(const TCHAR *szParam, UINT32 dwBufSize, TCHAR *szBuffer)
 {
-   if (m_dwDynamicFlags & NDF_AGENT_UNREACHABLE)
+   if (m_state & SSF_AGENT_UNREACHABLE)
       return DCE_COMM_ERROR;
 
    UINT32 dwError = ERR_NOT_CONNECTED, dwResult = DCE_COMM_ERROR;
@@ -752,7 +845,7 @@ UINT32 Sensor::getItemFromAgent(const TCHAR *szParam, UINT32 dwBufSize, TCHAR *s
    switch(m_commProtocol)
    {
       case COMM_LORAWAN:
-         parameter.replace(_T("*"), m_guid.toString());
+         prepareLoraDciParameters(parameter);
          break;
       case COMM_DLMS:
          if(parameter.find(_T("Sensor")) != -1)
@@ -797,13 +890,84 @@ UINT32 Sensor::getItemFromAgent(const TCHAR *szParam, UINT32 dwBufSize, TCHAR *s
 }
 
 /**
+ * Get list from agent
+ */
+UINT32 Sensor::getListFromAgent(const TCHAR *name, StringList **list)
+{
+   UINT32 dwError = ERR_NOT_CONNECTED, dwResult = DCE_COMM_ERROR;
+   UINT32 i, dwTries = 3;
+
+   *list = NULL;
+
+   if (m_state & SSF_AGENT_UNREACHABLE) //removed disable agent usage for all polls
+      return DCE_COMM_ERROR;
+
+   nxlog_debug(7, _T("Sensor(%s)->GetItemFromAgent(%s)"), m_name, name);
+   AgentConnectionEx *conn = getAgentConnection();
+   if (conn == NULL)
+   {
+      return dwResult;
+   }
+
+   String parameter(name);
+   switch(m_commProtocol)
+   {
+      case COMM_LORAWAN:
+         prepareLoraDciParameters(parameter);
+         break;
+      case COMM_DLMS:
+         if(parameter.find(_T("Sensor")) != -1)
+            prepareDlmsDciParameters(parameter);
+         break;
+   }
+   nxlog_debug(3, _T("Sensor(%s)->GetItemFromAgent(%s)"), m_name, parameter.getBuffer());
+
+   // Get parameter from agent
+   while(dwTries-- > 0)
+   {
+      dwError = conn->getList(parameter);
+      switch(dwError)
+      {
+         case ERR_SUCCESS:
+            dwResult = DCE_SUCCESS;
+            *list = new StringList;
+            for(i = 0; i < conn->getNumDataLines(); i++)
+               (*list)->add(conn->getDataLine(i));
+            break;
+         case ERR_UNKNOWN_PARAMETER:
+            dwResult = DCE_NOT_SUPPORTED;
+            break;
+         case ERR_NO_SUCH_INSTANCE:
+            dwResult = DCE_NO_SUCH_INSTANCE;
+            break;
+         case ERR_NOT_CONNECTED:
+         case ERR_CONNECTION_BROKEN:
+         case ERR_REQUEST_TIMEOUT:
+            // Reset connection to agent after timeout
+            DbgPrintf(7, _T("Sensor(%s)->getListFromAgent(%s): timeout; resetting connection to agent..."), m_name, name);
+            if (getAgentConnection() == NULL)
+               break;
+            break;
+            DbgPrintf(7, _T("Sensor(%s)->getListFromAgent(%s): connection to agent restored successfully"), m_name, name);
+            break;
+         case ERR_INTERNAL_ERROR:
+            dwResult = DCE_COLLECTION_ERROR;
+            break;
+      }
+   }
+
+   DbgPrintf(7, _T("Sensor(%s)->getListFromAgent(%s): dwError=%d dwResult=%d"), m_name, name, dwError, dwResult);
+   return dwResult;
+}
+
+/**
  * Prepare sensor object for deletion
  */
 void Sensor::prepareForDeletion()
 {
    // Prevent sensor from being queued for polling
    lockProperties();
-   m_dwDynamicFlags |= NDF_POLLING_DISABLED | NDF_DELETE_IN_PROGRESS;
+   m_runtimeFlags |= DCDF_DELETE_IN_PROGRESS;
    unlockProperties();
 
    // Wait for all pending polls
@@ -811,8 +975,8 @@ void Sensor::prepareForDeletion()
    while(1)
    {
       lockProperties();
-      if ((m_dwDynamicFlags &
-            (NDF_QUEUED_FOR_STATUS_POLL | NDF_QUEUED_FOR_CONFIG_POLL)) == 0)
+      if ((m_runtimeFlags &
+            (DCDF_QUEUED_FOR_STATUS_POLL | DCDF_QUEUED_FOR_CONFIGURATION_POLL)) == 0)
       {
          unlockProperties();
          break;
index 7fca8db..ce28c41 100644 (file)
@@ -86,7 +86,7 @@ UINT32 UnbindAgentTunnel(UINT32 nodeId);
 typedef struct
 {
    ClientSession *pSession;
-   Node *pNode;
+   DataCollectionTarget *pTarget;
    int iPollType;
    UINT32 dwRqId;
 } POLLER_START_DATA;
@@ -6049,22 +6049,23 @@ void ClientSession::forcedNodePoll(NXCPMessage *pRequest)
    object = FindObjectById(pRequest->getFieldAsUInt32(VID_OBJECT_ID));
    if (object != NULL)
    {
-      // We can do polls only for node objects
-      if ((object->getObjectClass() == OBJECT_NODE) &&
-          ((pData->iPollType == POLL_STATUS) ||
-                         (pData->iPollType == POLL_CONFIGURATION_FULL) ||
-                         (pData->iPollType == POLL_CONFIGURATION_NORMAL) ||
-                         (pData->iPollType == POLL_INSTANCE_DISCOVERY) ||
+      // We can do polls for node, sensor, cluster objects
+      if (((object->getObjectClass() == OBJECT_NODE) &&
+          ((pData->iPollType == POLL_CONFIGURATION_FULL) ||
                          (pData->iPollType == POLL_TOPOLOGY) ||
                          (pData->iPollType == POLL_INTERFACE_NAMES)))
+                         || (object->isDataCollectionTarget() &&
+          ((pData->iPollType == POLL_STATUS) ||
+                         (pData->iPollType == POLL_CONFIGURATION_NORMAL) ||
+                         (pData->iPollType == POLL_INSTANCE_DISCOVERY))))
       {
          // Check access rights
          if (object->checkAccessRights(m_dwUserId, OBJECT_ACCESS_MODIFY))
          {
-            ((Node *)object)->incRefCount();
+            ((DataCollectionTarget *)object)->incRefCount();
             InterlockedIncrement(&m_refCount);
 
-            pData->pNode = (Node *)object;
+            pData->pTarget = (DataCollectionTarget *)object;
             ThreadPoolExecute(g_mainThreadPool, pollerThreadStarter, pData);
             msg.setField(VID_RCC, RCC_OPERATION_IN_PROGRESS);
             msg.setField(VID_POLLER_MESSAGE, _T("Poll request accepted\r\n"));
@@ -6111,7 +6112,7 @@ void ClientSession::sendPollerMsg(UINT32 dwRqId, const TCHAR *pszMsg)
 void ClientSession::pollerThreadStarter(void *pArg)
 {
    ((POLLER_START_DATA *)pArg)->pSession->pollerThread(
-      ((POLLER_START_DATA *)pArg)->pNode,
+      ((POLLER_START_DATA *)pArg)->pTarget,
       ((POLLER_START_DATA *)pArg)->iPollType,
       ((POLLER_START_DATA *)pArg)->dwRqId);
    ((POLLER_START_DATA *)pArg)->pSession->decRefCount();
@@ -6121,7 +6122,7 @@ void ClientSession::pollerThreadStarter(void *pArg)
 /**
  * Node poller thread
  */
-void ClientSession::pollerThread(Node *pNode, int iPollType, UINT32 dwRqId)
+void ClientSession::pollerThread(DataCollectionTarget *pTarget, int iPollType, UINT32 dwRqId)
 {
    NXCPMessage msg;
 
@@ -6133,36 +6134,41 @@ void ClientSession::pollerThread(Node *pNode, int iPollType, UINT32 dwRqId)
    switch(iPollType)
    {
       case POLL_STATUS:
-         poller = RegisterPoller(POLLER_TYPE_STATUS, pNode);
+         poller = RegisterPoller(POLLER_TYPE_STATUS, pTarget);
          poller->startExecution();
-         pNode->statusPoll(this, dwRqId, poller);
+         pTarget->statusPoll(this, dwRqId, poller);
          break;
       case POLL_CONFIGURATION_FULL:
-                       pNode->setRecheckCapsFlag();
+         if(pTarget->getObjectClass() == OBJECT_NODE)
+            ((Node *)pTarget)->setRecheckCapsFlag();
          // intentionally no break here
       case POLL_CONFIGURATION_NORMAL:
-         poller = RegisterPoller(POLLER_TYPE_CONFIGURATION, pNode);
+         poller = RegisterPoller(POLLER_TYPE_CONFIGURATION, pTarget);
          poller->startExecution();
-         pNode->configurationPoll(this, dwRqId, poller, 0);
+         pTarget->configurationPoll(this, dwRqId, poller);
          break;
       case POLL_INSTANCE_DISCOVERY:
-         poller = RegisterPoller(POLLER_TYPE_INSTANCE_DISCOVERY, pNode);
+         poller = RegisterPoller(POLLER_TYPE_INSTANCE_DISCOVERY, pTarget);
          poller->startExecution();
-         pNode->instanceDiscoveryPoll(this, dwRqId, poller);
+         pTarget->instanceDiscoveryPoll(this, dwRqId, poller);
          break;
       case POLL_TOPOLOGY:
-         poller = RegisterPoller(POLLER_TYPE_TOPOLOGY, pNode);
-         poller->startExecution();
-         pNode->topologyPoll(this, dwRqId, poller);
+         if(pTarget->getObjectClass() == OBJECT_NODE)
+         {
+            poller = RegisterPoller(POLLER_TYPE_TOPOLOGY, pTarget);
+            poller->startExecution();
+            ((Node *)pTarget)->topologyPoll(this, dwRqId, poller);
+         }
          break;
       case POLL_INTERFACE_NAMES:
-         pNode->updateInterfaceNames(this, dwRqId);
+         if(pTarget->getObjectClass() == OBJECT_NODE)
+            ((Node *)pTarget)->updateInterfaceNames(this, dwRqId);
          break;
       default:
          sendPollerMsg(dwRqId, _T("Invalid poll type requested\r\n"));
          break;
    }
-   pNode->decRefCount();
+   pTarget->decRefCount();
    delete poller;
 
    msg.setCode(CMD_POLLING_INFO);
index a7b4f45..947b156 100644 (file)
@@ -119,7 +119,7 @@ static UINT32 STPPortListHandler(SNMP_Variable *var, SNMP_Transport *transport,
  */
 void AddSTPNeighbors(Node *node, LinkLayerNeighbors *nbs)
 {
-       if (!(node->getFlags() & NF_IS_STP))
+       if (!(node->getCapabilities() & NC_IS_STP))
                return;
 
        DbgPrintf(5, _T("STP: collecting topology information for node %s [%d]"), node->getName(), node->getId());
index b2501ef..86c3249 100644 (file)
@@ -188,7 +188,7 @@ bool Template::loadFromDatabase(DB_HANDLE hdb, UINT32 dwId)
    if (!loadCommonProperties(hdb))
       return false;
 
-   _sntprintf(szQuery, sizeof(szQuery) / sizeof(TCHAR), _T("SELECT version,flags,apply_filter FROM templates WHERE id=%d"), dwId);
+   _sntprintf(szQuery, sizeof(szQuery) / sizeof(TCHAR), _T("SELECT version,apply_filter FROM templates WHERE id=%d"), dwId);
    DB_RESULT hResult = DBSelect(hdb, szQuery);
    if (hResult == NULL)
       return false;
@@ -203,8 +203,7 @@ bool Template::loadFromDatabase(DB_HANDLE hdb, UINT32 dwId)
    bool success = true;
 
    m_dwVersion = DBGetFieldULong(hResult, 0, 0);
-       m_flags = DBGetFieldULong(hResult, 0, 1);
-   m_applyFilterSource = DBGetField(hResult, 0, 2, NULL, 0);
+   m_applyFilterSource = DBGetField(hResult, 0, 1, NULL, 0);
    if (m_applyFilterSource != NULL)
    {
       TCHAR error[256];
@@ -280,11 +279,11 @@ BOOL Template::saveToDatabase(DB_HANDLE hdb)
        DB_STATEMENT hStmt;
    if (IsDatabaseRecordExist(hdb, _T("templates"), _T("id"), m_id))
        {
-               hStmt = DBPrepare(hdb, _T("UPDATE templates SET version=?,flags=?,apply_filter=? WHERE id=?"));
+               hStmt = DBPrepare(hdb, _T("UPDATE templates SET version=?,apply_filter=? WHERE id=?"));
        }
    else
        {
-               hStmt = DBPrepare(hdb, _T("INSERT INTO templates (version,flags,apply_filter,id) VALUES (?,?,?,?)"));
+               hStmt = DBPrepare(hdb, _T("INSERT INTO templates (version,apply_filter,id) VALUES (?,?,?)"));
        }
        if (hStmt == NULL)
        {
@@ -293,9 +292,8 @@ BOOL Template::saveToDatabase(DB_HANDLE hdb)
        }
 
        DBBind(hStmt, 1, DB_SQLTYPE_INTEGER, m_dwVersion);
-       DBBind(hStmt, 2, DB_SQLTYPE_INTEGER, m_flags);
-       DBBind(hStmt, 3, DB_SQLTYPE_TEXT, m_applyFilterSource, DB_BIND_STATIC);
-       DBBind(hStmt, 4, DB_SQLTYPE_INTEGER, m_id);
+       DBBind(hStmt, 2, DB_SQLTYPE_TEXT, m_applyFilterSource, DB_BIND_STATIC);
+       DBBind(hStmt, 3, DB_SQLTYPE_INTEGER, m_id);
        BOOL success = DBExecute(hStmt);
        DBFreeStatement(hStmt);
 
@@ -883,7 +881,6 @@ void Template::fillMessageInternal(NXCPMessage *pMsg)
 {
    NetObj::fillMessageInternal(pMsg);
    pMsg->setField(VID_TEMPLATE_VERSION, m_dwVersion);
-       pMsg->setField(VID_FLAGS, m_flags);
        pMsg->setField(VID_AUTOBIND_FILTER, CHECK_NULL_EX(m_applyFilterSource));
 }
 
index 4be43ed..0b198ae 100644 (file)
@@ -504,7 +504,7 @@ private:
    void readThread();
    void writeThread();
    void processingThread();
-   void pollerThread(Node *pNode, int iPollType, UINT32 dwRqId);
+   void pollerThread(DataCollectionTarget *pNode, int iPollType, UINT32 dwRqId);
 
    void debugPrintf(int level, const TCHAR *format, ...);
 
index 497ecfc..512dfac 100644 (file)
@@ -86,39 +86,6 @@ bool NXCORE_EXPORTABLE ExecuteQueryOnObject(DB_HANDLE hdb, UINT32 objectId, cons
  */
 #define ALL_ZONES ((UINT32)0xFFFFFFFF)
 
-/**
- * Node runtime (dynamic) flags
- */
-#define NDF_QUEUED_FOR_STATUS_POLL     0x000001
-#define NDF_QUEUED_FOR_CONFIG_POLL     0x000002
-#define NDF_UNREACHABLE                0x000004
-#define NDF_AGENT_UNREACHABLE          0x000008
-#define NDF_SNMP_UNREACHABLE           0x000010
-#define NDF_QUEUED_FOR_DISCOVERY_POLL  0x000020
-#define NDF_FORCE_STATUS_POLL          0x000040
-#define NDF_FORCE_CONFIGURATION_POLL   0x000080
-#define NDF_QUEUED_FOR_ROUTE_POLL      0x000100
-#define NDF_CPSNMP_UNREACHABLE         0x000200
-#define NDF_RECHECK_CAPABILITIES       0x000400
-#define NDF_POLLING_DISABLED           0x000800
-#define NDF_CONFIGURATION_POLL_PASSED  0x001000
-#define NDF_QUEUED_FOR_TOPOLOGY_POLL   0x002000
-#define NDF_DELETE_IN_PROGRESS         0x004000
-#define NDF_NETWORK_PATH_PROBLEM       0x008000
-#define NDF_QUEUED_FOR_INSTANCE_POLL   0x010000
-#define NDF_CACHE_MODE_NOT_SUPPORTED   0x020000
-
-#define NDF_PERSISTENT (NDF_UNREACHABLE | NDF_NETWORK_PATH_PROBLEM | NDF_AGENT_UNREACHABLE | NDF_SNMP_UNREACHABLE | NDF_CPSNMP_UNREACHABLE | NDF_CACHE_MODE_NOT_SUPPORTED)
-
-#define __NDF_FLAGS_DEFINED
-
-/**
- * Cluster runtime flags
- */
-#define CLF_QUEUED_FOR_STATUS_POLL        0x0001
-#define CLF_DOWN                          0x0002
-#define CLF_QUEUED_FOR_CONFIGURATION_POLL 0x0004
-
 class AgentTunnel;
 
 /**
@@ -505,6 +472,9 @@ protected:
    int m_statusTranslation[4];
    int m_statusSingleThreshold;
    int m_statusThresholds[4];
+   UINT32 m_flags;
+   UINT32 m_runtimeFlags;
+   UINT32 m_state;
    bool m_isModified;
    bool m_isDeleted;
    bool m_isHidden;
@@ -587,6 +557,9 @@ public:
    UINT32 getId() const { return m_id; }
    const TCHAR *getName() const { return m_name; }
    int getStatus() const { return m_status; }
+   UINT32 getState() const { return m_state; }
+   UINT32 getRuntimeFlags() const { return m_runtimeFlags; }
+   UINT32 getFlags() const { return m_flags; }
    int getPropagatedStatus();
    time_t getTimeStamp() const { return m_timestamp; }
        const uuid& getGuid() const { return m_guid; }
@@ -608,6 +581,8 @@ public:
 
        bool isSystem() const { return m_isSystem; }
        void setSystemFlag(bool flag) { m_isSystem = flag; }
+       void setFlag(UINT32 flag) { lockProperties(); m_flags |= flag; setModified(); unlockProperties(); }
+       void clearFlag(UINT32 flag) { lockProperties(); m_flags &= ~flag; setModified(); unlockProperties(); }
 
    UINT32 getRefCount();
    void incRefCount();
@@ -747,7 +722,6 @@ protected:
        ObjectArray<DCObject> *m_dcObjects;
    int m_dciLockStatus;
    UINT32 m_dwVersion;
-       UINT32 m_flags;
    bool m_dciListModified;
    TCHAR m_szCurrDCIOwner[MAX_SESSION_NAME];
        TCHAR *m_applyFilterSource;
@@ -787,7 +761,6 @@ public:
 
    virtual void calculateCompoundStatus(BOOL bForcedRecalc = FALSE);
 
-   UINT32 getFlags() const { return m_flags; }
    int getVersionMajor() { return m_dwVersion >> 16; }
    int getVersionMinor() { return m_dwVersion & 0xFFFF; }
 
@@ -841,7 +814,6 @@ protected:
    UINT32 m_index;
    BYTE m_macAddr[MAC_ADDR_LENGTH];
    InetAddressList m_ipAddressList;
-       UINT32 m_flags;
        TCHAR m_description[MAX_DB_STRING];     // Interface description - value of ifDescr for SNMP, equals to name for NetXMS agent
        TCHAR m_alias[MAX_DB_STRING];   // Interface alias - value of ifAlias for SNMP, empty for NetXMS agent
    UINT32 m_type;
@@ -913,7 +885,6 @@ public:
        UINT32 getPeerNodeId() const { return m_peerNodeId; }
        UINT32 getPeerInterfaceId() const { return m_peerInterfaceId; }
    LinkLayerProtocol getPeerDiscoveryProtocol() const { return m_peerDiscoveryProtocol; }
-       UINT32 getFlags() const { return m_flags; }
        int getExpectedState() const { return (int)((m_flags & IF_EXPECTED_STATE_MASK) >> 28); }
        int getAdminState() const { return (int)m_adminState; }
        int getOperState() const { return (int)m_operState; }
@@ -1068,6 +1039,13 @@ class NXCORE_EXPORTABLE DataCollectionTarget : public Template
 protected:
    UINT32 m_pingTime;
    time_t m_pingLastTimeStamp;
+   time_t m_lastConfigurationPoll;
+   time_t m_lastStatusPoll;
+   time_t m_lastInstancePoll;
+   MUTEX m_hPollerMutex;
+
+   void pollerLock() { MutexLock(m_hPollerMutex); }
+   void pollerUnlock() { MutexUnlock(m_hPollerMutex); }
 
        virtual void fillMessageInternal(NXCPMessage *pMsg);
        virtual void fillMessageInternalStage2(NXCPMessage *pMsg);
@@ -1135,8 +1113,118 @@ public:
    int getMostCriticalDCIStatus();
 
    UINT32 getPingTime();
+
+   virtual void statusPoll(PollerInfo *poller);
+   virtual void statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller) { /* do nothing */ }
+   virtual bool isReadyForStatusPoll();
+   void lockForStatusPoll();
+   void unlockForStatusPoll();
+
+   void configurationPoll(PollerInfo *poller);
+   virtual void configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller)  { /* do nothing */ }
+   virtual bool isReadyForConfigurationPoll();
+   void lockForConfigurationPoll();
+   void unlockForConfigurationPoll();
+
+   void instanceDiscoveryPoll(PollerInfo *poller);
+   void instanceDiscoveryPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller);
+   void doInstanceDiscovery(UINT32 requestId);
+   virtual StringMap *getInstanceList(DCObject *dco)  { return NULL; }
+   bool updateInstances(DCObject *root, StringMap *instances, UINT32 requestId);
+   virtual bool isReadyForInstancePoll();
+   void lockForInstancePoll();
+   void unlockForInstancePoll();
+
+   void executeHookScript(const TCHAR *hookName);
 };
 
+inline bool DataCollectionTarget::isReadyForInstancePoll()
+{
+       if (m_isDeleted)
+               return false;
+   return (m_status != STATUS_UNMANAGED) &&
+              (!(m_flags & DCF_DISABLE_CONF_POLL)) &&
+          (!(m_runtimeFlags & DCDF_QUEUED_FOR_INSTANCE_POLL)) &&
+          (!(m_runtimeFlags & DCDF_DELETE_IN_PROGRESS)) &&
+          (m_runtimeFlags & DCDF_CONFIGURATION_POLL_PASSED) &&
+          ((UINT32)(time(NULL) - m_lastInstancePoll) > g_instancePollingInterval);
+
+}
+
+inline void DataCollectionTarget::lockForInstancePoll()
+{
+   lockProperties();
+   m_runtimeFlags |= DCDF_QUEUED_FOR_INSTANCE_POLL;
+   unlockProperties();
+}
+
+inline void DataCollectionTarget::unlockForInstancePoll()
+{
+   lockProperties();
+   m_runtimeFlags &= ~DCDF_QUEUED_FOR_INSTANCE_POLL;
+   unlockProperties();
+}
+
+inline bool DataCollectionTarget::isReadyForConfigurationPoll()
+{
+
+       if (m_isDeleted)
+               return false;
+   if (m_runtimeFlags & DCDF_FORCE_CONFIGURATION_POLL)
+   {
+      m_runtimeFlags &= ~DCDF_FORCE_CONFIGURATION_POLL;
+      return true;
+   }
+   return (m_status != STATUS_UNMANAGED) &&
+              (!(m_flags & DCF_DISABLE_CONF_POLL)) &&
+          (!(m_runtimeFlags & DCDF_QUEUED_FOR_CONFIGURATION_POLL)) &&
+          (!(m_runtimeFlags & DCDF_DELETE_IN_PROGRESS)) &&
+          ((UINT32)(time(NULL) - m_lastConfigurationPoll) > g_dwConfigurationPollingInterval);
+}
+
+inline void DataCollectionTarget::lockForConfigurationPoll()
+{
+   lockProperties();
+   m_runtimeFlags |= DCDF_QUEUED_FOR_CONFIGURATION_POLL;
+   unlockProperties();
+}
+
+inline void DataCollectionTarget::unlockForConfigurationPoll()
+{
+   lockProperties();
+   m_runtimeFlags &= ~DCDF_QUEUED_FOR_CONFIGURATION_POLL;
+   unlockProperties();
+}
+
+inline bool DataCollectionTarget::isReadyForStatusPoll()
+{
+       if (m_isDeleted)
+               return false;
+   if (m_runtimeFlags & DCDF_FORCE_STATUS_POLL)
+   {
+      m_runtimeFlags &= ~DCDF_FORCE_STATUS_POLL;
+      return true;
+   }
+   return (m_status != STATUS_UNMANAGED) &&
+              (!(m_flags & DCF_DISABLE_STATUS_POLL)) &&
+          (!(m_runtimeFlags & DCDF_QUEUED_FOR_STATUS_POLL)) &&
+          (!(m_runtimeFlags & DCDF_DELETE_IN_PROGRESS)) &&
+          ((UINT32)(time(NULL) - m_lastStatusPoll) > g_dwStatusPollingInterval);
+}
+inline void DataCollectionTarget::lockForStatusPoll()
+{
+   lockProperties();
+   m_runtimeFlags |= DCDF_QUEUED_FOR_STATUS_POLL;
+   unlockProperties();
+}
+
+inline void DataCollectionTarget::unlockForStatusPoll()
+{
+   lockProperties();
+   m_runtimeFlags &= ~DCDF_QUEUED_FOR_STATUS_POLL;
+   unlockProperties();
+}
+
 /**
  * Mobile device class
  */
@@ -1187,6 +1275,10 @@ public:
        const LONG getBatteryLevel() { return m_batteryLevel; }
 
        virtual UINT32 getInternalItem(const TCHAR *param, size_t bufSize, TCHAR *buffer);
+
+       virtual bool isReadyForStatusPoll()  { return false; }
+       virtual bool isReadyForConfigurationPoll()  { return false; }
+       virtual bool isReadyForInstancePoll() { return false; }
 };
 
 /**
@@ -1203,7 +1295,7 @@ protected:
        TCHAR *m_model;
        TCHAR *m_serialNumber;
        ObjectArray<RadioInterfaceInfo> *m_radioInterfaces;
-   AccessPointState m_state;
+   AccessPointState m_apState;
    AccessPointState m_prevState;
 
        virtual void fillMessageInternal(NXCPMessage *pMsg);
@@ -1232,7 +1324,7 @@ public:
        bool isMyRadio(int rfIndex);
        bool isMyRadio(const BYTE *macAddr);
        void getRadioName(int rfIndex, TCHAR *buffer, size_t bufSize);
-   AccessPointState getState() { return m_state; }
+   AccessPointState getState() { return m_apState; }
    Node *getParentNode();
 
        void attachToNode(UINT32 nodeId);
@@ -1240,6 +1332,10 @@ public:
        void updateRadioInterfaces(const ObjectArray<RadioInterfaceInfo> *ri);
        void updateInfo(const TCHAR *vendor, const TCHAR *model, const TCHAR *serialNumber);
    void updateState(AccessPointState state);
+
+   virtual bool isReadyForStatusPoll()  { return false; }
+   virtual bool isReadyForConfigurationPoll()  { return false; }
+   virtual bool isReadyForInstancePoll() { return false; }
 };
 
 /**
@@ -1252,8 +1348,6 @@ protected:
    ObjectArray<InetAddress> *m_syncNetworks;
        UINT32 m_dwNumResources;
        CLUSTER_RESOURCE *m_pResourceList;
-       time_t m_lastStatusPoll;
-   time_t m_lastConfigurationPoll;
        UINT32 m_zoneUIN;
 
    virtual void fillMessageInternal(NXCPMessage *pMsg);
@@ -1287,27 +1381,9 @@ public:
    UINT32 getResourceOwner(const TCHAR *resourceName) { return getResourceOwnerInternal(0, resourceName); }
    UINT32 getZoneUIN() const { return m_zoneUIN; }
 
-   void statusPoll(PollerInfo *poller);
    void statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller);
-   void lockForStatusPoll() { m_flags |= CLF_QUEUED_FOR_STATUS_POLL; }
-   bool isReadyForStatusPoll()
-   {
-      return ((m_status != STATUS_UNMANAGED) && (!m_isDeleted) &&
-              (!(m_flags & CLF_QUEUED_FOR_STATUS_POLL)) &&
-              ((UINT32)time(NULL) - (UINT32)m_lastStatusPoll > g_dwStatusPollingInterval))
-                  ? true : false;
-   }
-
-   void configurationPoll(PollerInfo *poller);
    void configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller);
-   void lockForConfigurationPoll() { m_flags |= CLF_QUEUED_FOR_CONFIGURATION_POLL; }
-   bool isReadyForConfigurationPoll()
-   {
-      return ((m_status != STATUS_UNMANAGED) && (!m_isDeleted) &&
-              (!(m_flags & CLF_QUEUED_FOR_CONFIGURATION_POLL)) &&
-              ((UINT32)time(NULL) - (UINT32)m_lastConfigurationPoll > g_dwConfigurationPollingInterval))
-                  ? true : false;
-   }
+   bool isReadyForInstancePoll() { return false; }
 
    UINT32 collectAggregatedData(DCItem *item, TCHAR *buffer);
    UINT32 collectAggregatedData(DCTable *table, Table **result);
@@ -1360,15 +1436,11 @@ public:
    bool bindUnderController() { return (m_flags & CHF_BIND_UNDER_CONTROLLER) ? true : false; }
 
    void setBindUnderController(bool doBind);
-};
 
-/**
- * Sensor flags
- */
-#define SENSOR_PROVISIONED          0x00000001
-#define SENSOR_REGISTERED           0x00000002
-#define SENSOR_ACTIVE               0x00000004
-#define SENSOR_CONF_UPDATE_PENDING  0x00000008
+   virtual bool isReadyForStatusPoll()  { return false; }
+   virtual bool isReadyForConfigurationPoll()  { return false; }
+   virtual bool isReadyForInstancePoll() { return false; }
+};
 
 /**
  * Sensor communication protocol type
@@ -1391,7 +1463,6 @@ public:
 class NXCORE_EXPORTABLE Sensor : public DataCollectionTarget
 {
 protected:
-       UINT32 m_flags;
        MacAddress m_macAddress;
        UINT32 m_deviceClass; // Internal device class UPS, meeter
        TCHAR *m_vendor; //Vendoer name lorawan...
@@ -1408,10 +1479,6 @@ protected:
    INT32 m_signalNoise; //*10 from origin number //MAX_INT32 when no value
    UINT32 m_frequency; //*10 from origin number // 0 when no value
    UINT32 m_proxyNodeId;
-   UINT32 m_dwDynamicFlags;       // Flags used at runtime by server
-   time_t m_lastStatusPoll;
-   time_t m_lastConfigurationPoll;
-   MUTEX m_hPollerMutex;
 
        virtual void fillMessageInternal(NXCPMessage *msg);
    virtual UINT32 modifyFromMessageInternal(NXCPMessage *request);
@@ -1420,11 +1487,6 @@ protected:
                TCHAR *metaType, TCHAR *description, UINT32 proxyNode);
    static Sensor *registerLoraDevice(Sensor *sensor);
 
-   void calculateStatus();
-
-   void pollerLock() { MutexLock(m_hPollerMutex); }
-   void pollerUnlock() { MutexUnlock(m_hPollerMutex); }
-
 public:
    Sensor();
 
@@ -1446,86 +1508,35 @@ public:
    const TCHAR *getDescription() const { return m_description; }
    UINT32 getFrameCount() const { return m_frameCount; }
 
-   void statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller);
-   void statusPoll(PollerInfo *poller);
+   StringMap *getInstanceList(DCObject *dco);
 
-   void configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller, int maskBits);
-   void configurationPoll(PollerInfo *poller);
+   void statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller);
+   void configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller);
 
    UINT32 getItemFromAgent(const TCHAR *szParam, UINT32 dwBufSize, TCHAR *szBuffer);
+   UINT32 getListFromAgent(const TCHAR *name, StringList **list);
 
-   void setProvisoned() { m_flags |= SENSOR_PROVISIONED; }
-
-   UINT32 getRuntimeFlags() const { return m_dwDynamicFlags; }
+   void setProvisoned() { m_state |= SSF_PROVISIONED; }
 
    virtual bool loadFromDatabase(DB_HANDLE hdb, UINT32 id);
    virtual BOOL saveToDatabase(DB_HANDLE hdb);
    virtual bool deleteFromDatabase(DB_HANDLE hdb);
 
    virtual NXSL_Value *createNXSLObject();
+   virtual void calculateCompoundStatus(BOOL bForcedRecalc = FALSE);
+   void calculateStatus(BOOL bForcedRecalc = FALSE);
 
    virtual json_t *toJson();
 
-   bool isReadyForStatusPoll();
-   bool isReadyForConfigurationPoll();
-
-   void lockForStatusPoll();
-   void lockForConfigurationPoll();
-
    AgentConnectionEx *getAgentConnection();
 
    void checkDlmsConverterAccessability();
    void prepareDlmsDciParameters(String &parameter);
+   void prepareLoraDciParameters(String &parameter);
 
    virtual void prepareForDeletion();
 };
 
-inline bool Sensor::isReadyForStatusPoll()
-{
-   if (m_isDeleted)
-      return false;
-   if (m_dwDynamicFlags & NDF_FORCE_STATUS_POLL)
-   {
-      m_dwDynamicFlags &= ~NDF_FORCE_STATUS_POLL;
-      return true;
-   }
-   return (m_status != STATUS_UNMANAGED) &&
-          (!(m_flags & NF_DISABLE_STATUS_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_QUEUED_FOR_STATUS_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_POLLING_DISABLED)) &&
-          ((UINT32)(time(NULL) - m_lastStatusPoll) > g_dwStatusPollingInterval);
-}
-
-inline bool Sensor::isReadyForConfigurationPoll()
-{
-   if (m_isDeleted)
-      return false;
-   if (m_dwDynamicFlags & NDF_FORCE_CONFIGURATION_POLL)
-   {
-      m_dwDynamicFlags &= ~NDF_FORCE_CONFIGURATION_POLL;
-      return true;
-   }
-   return (m_status != STATUS_UNMANAGED) &&
-          (!(m_flags & NF_DISABLE_CONF_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_QUEUED_FOR_CONFIG_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_POLLING_DISABLED)) &&
-          ((UINT32)(time(NULL) - m_lastConfigurationPoll) > g_dwConfigurationPollingInterval);
-}
-
-inline void Sensor::lockForStatusPoll()
-{
-   lockProperties();
-   m_dwDynamicFlags |= NDF_QUEUED_FOR_STATUS_POLL;
-   unlockProperties();
-}
-
-inline void Sensor::lockForConfigurationPoll()
-{
-   lockProperties();
-   m_dwDynamicFlags |= NDF_QUEUED_FOR_CONFIG_POLL;
-   unlockProperties();
-}
-
 class Subnet;
 struct ProxyInfo;
 
@@ -1611,7 +1622,7 @@ protected:
    InetAddress m_ipAddress;
        TCHAR m_primaryName[MAX_DNS_NAME];
        uuid m_tunnelId;
-   UINT32 m_dwDynamicFlags;       // Flags used at runtime by server
+   UINT32 m_capabilities;
    NodeType m_type;
    TCHAR m_subType[MAX_NODE_SUBTYPE_LENGTH];
        int m_iPendingStatus;
@@ -1641,10 +1652,7 @@ protected:
        DriverData *m_driverData;
    ObjectArray<AgentParameterDefinition> *m_paramList; // List of supported parameters
    ObjectArray<AgentTableDefinition> *m_tableList; // List of supported tables
-   time_t m_lastDiscoveryPoll;
-   time_t m_lastStatusPoll;
-   time_t m_lastConfigurationPoll;
-       time_t m_lastInstancePoll;
+       time_t m_lastDiscoveryPoll;
        time_t m_lastTopologyPoll;
    time_t m_lastRTUpdate;
    time_t m_failTimeSNMP;
@@ -1654,7 +1662,6 @@ protected:
    time_t m_agentUpTime;
    time_t m_lastAgentCommTime;
    time_t m_lastAgentConnectAttempt;
-   MUTEX m_hPollerMutex;
    MUTEX m_hAgentAccessMutex;
    MUTEX m_hSmclpAccessMutex;
    MUTEX m_mutexRTAccess;
@@ -1701,9 +1708,6 @@ protected:
        UINT32 m_portNumberingScheme;
        UINT32 m_portRowCount;
 
-   void pollerLock() { MutexLock(m_hPollerMutex); }
-   void pollerUnlock() { MutexUnlock(m_hPollerMutex); }
-
    void agentLock() { MutexLock(m_hAgentAccessMutex); }
    void agentUnlock() { MutexUnlock(m_hAgentAccessMutex); }
 
@@ -1736,7 +1740,6 @@ protected:
        bool querySnmpSysProperty(SNMP_Transport *snmp, const TCHAR *oid, const TCHAR *propName, UINT32 pollRqId, TCHAR **value);
        void checkBridgeMib(SNMP_Transport *pTransport);
        void checkIfXTable(SNMP_Transport *pTransport);
-       void executeHookScript(const TCHAR *hookName);
        bool checkNetworkPath(UINT32 requestId);
    bool checkNetworkPathLayer2(UINT32 requestId, bool secondPass);
    bool checkNetworkPathLayer3(UINT32 requestId, bool secondPass);
@@ -1771,7 +1774,7 @@ protected:
 
 public:
    Node();
-   Node(const InetAddress& addr, UINT32 dwFlags, UINT32 agentProxy, UINT32 snmpProxy, UINT32 icmpProxy, UINT32 sshProxy, UINT32 zoneUIN);
+   Node(const InetAddress& addr, UINT32 flags, UINT32 capabilities, UINT32 agentProxy, UINT32 snmpProxy, UINT32 icmpProxy, UINT32 sshProxy, UINT32 zoneUIN);
    virtual ~Node();
 
    virtual int getObjectClass() const { return OBJECT_NODE; }
@@ -1792,22 +1795,22 @@ public:
    UINT32 getZoneUIN() const { return m_zoneUIN; }
    NodeType getType() const { return m_type; }
    const TCHAR *getSubType() const { return m_subType; }
-   UINT32 getRuntimeFlags() const { return m_dwDynamicFlags; }
 
-   void setFlag(UINT32 flag) { lockProperties(); m_flags |= flag; setModified(); unlockProperties(); }
-   void clearFlag(UINT32 flag) { lockProperties(); m_flags &= ~flag; setModified(); unlockProperties(); }
-   void setLocalMgmtFlag() { m_flags |= NF_IS_LOCAL_MGMT; }
-   void clearLocalMgmtFlag() { m_flags &= ~NF_IS_LOCAL_MGMT; }
+   UINT32 getCapabilities() { return m_capabilities; }
+   void setCapabilitie(UINT32 flag) { lockProperties(); m_capabilities |= flag; setModified(); unlockProperties(); }
+   void clearCapabilities(UINT32 flag) { lockProperties(); m_capabilities &= ~flag; setModified(); unlockProperties(); }
+   void setLocalMgmtFlag() { m_capabilities |= NC_IS_LOCAL_MGMT; }
+   void clearLocalMgmtFlag() { m_capabilities &= ~NC_IS_LOCAL_MGMT; }
 
    void setType(NodeType type, const TCHAR *subType) { lockProperties(); m_type = type; nx_strncpy(m_subType, subType, MAX_NODE_SUBTYPE_LENGTH); unlockProperties(); }
 
-   bool isSNMPSupported() const { return m_flags & NF_IS_SNMP ? true : false; }
-   bool isNativeAgent() const { return m_flags & NF_IS_NATIVE_AGENT ? true : false; }
-   bool isBridge() const { return m_flags & NF_IS_BRIDGE ? true : false; }
-   bool isRouter() const { return m_flags & NF_IS_ROUTER ? true : false; }
-   bool isLocalManagement() const { return m_flags & NF_IS_LOCAL_MGMT ? true : false; }
+   bool isSNMPSupported() const { return m_capabilities & NC_IS_SNMP ? true : false; }
+   bool isNativeAgent() const { return m_capabilities & NC_IS_NATIVE_AGENT ? true : false; }
+   bool isBridge() const { return m_capabilities & NC_IS_BRIDGE ? true : false; }
+   bool isRouter() const { return m_capabilities & NC_IS_ROUTER ? true : false; }
+   bool isLocalManagement() const { return m_capabilities & NC_IS_LOCAL_MGMT ? true : false; }
        bool isPerVlanFdbSupported() const { return (m_driver != NULL) ? m_driver->isPerVlanFdbSupported() : false; }
-       bool isWirelessController() const { return m_flags & NF_IS_WIFI_CONTROLLER ? true : false; }
+       bool isWirelessController() const { return m_capabilities & NC_IS_WIFI_CONTROLLER ? true : false; }
 
        const TCHAR *getAgentVersion() const { return m_agentVersion; }
        const TCHAR *getPlatformName() const { return m_platformName; }
@@ -1824,7 +1827,7 @@ public:
        const TCHAR *getDriverName() const { return (m_driver != NULL) ? m_driver->getName() : _T("GENERIC"); }
        UINT16 getAgentPort() const { return m_agentPort; }
        INT16 getAgentAuthMethod() const { return m_agentAuthMethod; }
-   INT16 getAgentCacheMode() const { return (m_dwDynamicFlags & NDF_CACHE_MODE_NOT_SUPPORTED) ? AGENT_CACHE_OFF : ((m_agentCacheMode == AGENT_CACHE_DEFAULT) ? g_defaultAgentCacheMode : m_agentCacheMode); }
+   INT16 getAgentCacheMode() const { return (m_state & NSF_CACHE_MODE_NOT_SUPPORTED) ? AGENT_CACHE_OFF : ((m_agentCacheMode == AGENT_CACHE_DEFAULT) ? g_defaultAgentCacheMode : m_agentCacheMode); }
        const TCHAR *getSharedSecret() const { return m_szSharedSecret; }
        UINT32 getRackId() const { return m_rackId; }
    INT16 getRackHeight() const { return m_rackHeight; }
@@ -1838,7 +1841,7 @@ public:
    const TCHAR *getPrimaryName() const { return m_primaryName; }
    const uuid& getTunnelId() const { return m_tunnelId; }
 
-   bool isDown() { return (m_dwDynamicFlags & NDF_UNREACHABLE) ? true : false; }
+   bool isDown() { return (m_state & NSF_UNREACHABLE) ? true : false; }
        time_t getDownTime() const { return m_downSince; }
 
    void addInterface(Interface *pInterface) { addChild(pInterface); pInterface->addParent(this); }
@@ -1883,13 +1886,12 @@ public:
    bool getLldpLocalPortInfo(UINT32 idType, BYTE *id, size_t idLen, LLDP_LOCAL_PORT_INFO *port);
    void showLLDPInfo(CONSOLE_CTX console);
 
-       void setRecheckCapsFlag() { m_dwDynamicFlags |= NDF_RECHECK_CAPABILITIES; }
+       void setRecheckCapsFlag() { m_runtimeFlags |= NDF_RECHECK_CAPABILITIES; }
    void setDiscoveryPollTimeStamp();
-   void statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller);
    void statusPoll(PollerInfo *poller);
-   void configurationPoll(PollerInfo *poller);
+   void statusPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller);
+   void configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller);
    void configurationPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller, int maskBits);
-       void instanceDiscoveryPoll(PollerInfo *poller);
        void instanceDiscoveryPoll(ClientSession *session, UINT32 requestId, PollerInfo *poller);
        void topologyPoll(PollerInfo *poller);
        void topologyPoll(ClientSession *pSession, UINT32 dwRqId, PollerInfo *poller);
@@ -1902,19 +1904,14 @@ public:
    void setChassis(UINT32 chassisId);
 
    bool isReadyForStatusPoll();
-   bool isReadyForConfigurationPoll();
-   bool isReadyForInstancePoll();
    bool isReadyForDiscoveryPoll();
    bool isReadyForRoutePoll();
    bool isReadyForTopologyPoll();
 
-   void lockForStatusPoll();
-   void lockForConfigurationPoll();
-   void lockForInstancePoll();
    void lockForDiscoveryPoll();
    void lockForRoutePoll();
    void lockForTopologyPoll();
-       void forceConfigurationPoll() { m_dwDynamicFlags |= NDF_FORCE_CONFIGURATION_POLL; }
+       void forceConfigurationPoll() { m_runtimeFlags |= DCDF_FORCE_CONFIGURATION_POLL; }
 
    virtual void calculateCompoundStatus(BOOL bForcedRecalc = FALSE);
 
@@ -2000,42 +1997,26 @@ public:
 inline void Node::setDiscoveryPollTimeStamp()
 {
    m_lastDiscoveryPoll = time(NULL);
-   m_dwDynamicFlags &= ~NDF_QUEUED_FOR_DISCOVERY_POLL;
+   m_runtimeFlags &= ~NDF_QUEUED_FOR_DISCOVERY_POLL;
 }
 
 inline bool Node::isReadyForStatusPoll()
 {
        if (m_isDeleted)
                return false;
-   if (m_dwDynamicFlags & NDF_FORCE_STATUS_POLL)
+   if (m_runtimeFlags & DCDF_FORCE_STATUS_POLL)
    {
-      m_dwDynamicFlags &= ~NDF_FORCE_STATUS_POLL;
+      m_runtimeFlags &= ~DCDF_FORCE_STATUS_POLL;
       return true;
    }
    return (m_status != STATUS_UNMANAGED) &&
-              (!(m_flags & NF_DISABLE_STATUS_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_QUEUED_FOR_STATUS_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_POLLING_DISABLED)) &&
+              (!(m_flags & DCF_DISABLE_STATUS_POLL)) &&
+          (!(m_runtimeFlags & DCDF_QUEUED_FOR_STATUS_POLL)) &&
+          (!(m_runtimeFlags & DCDF_DELETE_IN_PROGRESS)) &&
                         (getMyCluster() == NULL) &&
           ((UINT32)(time(NULL) - m_lastStatusPoll) > g_dwStatusPollingInterval);
 }
 
-inline bool Node::isReadyForConfigurationPoll()
-{
-       if (m_isDeleted)
-               return false;
-   if (m_dwDynamicFlags & NDF_FORCE_CONFIGURATION_POLL)
-   {
-      m_dwDynamicFlags &= ~NDF_FORCE_CONFIGURATION_POLL;
-      return true;
-   }
-   return (m_status != STATUS_UNMANAGED) &&
-              (!(m_flags & NF_DISABLE_CONF_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_QUEUED_FOR_CONFIG_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_POLLING_DISABLED)) &&
-          ((UINT32)(time(NULL) - m_lastConfigurationPoll) > g_dwConfigurationPollingInterval);
-}
-
 inline bool Node::isReadyForDiscoveryPoll()
 {
        if (m_isDeleted)
@@ -2043,9 +2024,9 @@ inline bool Node::isReadyForDiscoveryPoll()
    return (g_flags & AF_ENABLE_NETWORK_DISCOVERY) &&
           (m_status != STATUS_UNMANAGED) &&
                         (!(m_flags & NF_DISABLE_DISCOVERY_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_QUEUED_FOR_DISCOVERY_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_POLLING_DISABLED)) &&
-          (m_dwDynamicFlags & NDF_CONFIGURATION_POLL_PASSED) &&
+          (!(m_runtimeFlags & NDF_QUEUED_FOR_DISCOVERY_POLL)) &&
+          (!(m_runtimeFlags & DCDF_DELETE_IN_PROGRESS)) &&
+          (m_runtimeFlags & DCDF_CONFIGURATION_POLL_PASSED) &&
           ((UINT32)(time(NULL) - m_lastDiscoveryPoll) > g_dwDiscoveryPollingInterval);
 }
 
@@ -2055,9 +2036,9 @@ inline bool Node::isReadyForRoutePoll()
                return false;
    return (m_status != STATUS_UNMANAGED) &&
               (!(m_flags & NF_DISABLE_ROUTE_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_QUEUED_FOR_ROUTE_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_POLLING_DISABLED)) &&
-          (m_dwDynamicFlags & NDF_CONFIGURATION_POLL_PASSED) &&
+          (!(m_runtimeFlags & NDF_QUEUED_FOR_ROUTE_POLL)) &&
+          (!(m_runtimeFlags & DCDF_DELETE_IN_PROGRESS)) &&
+          (m_runtimeFlags & DCDF_CONFIGURATION_POLL_PASSED) &&
           ((UINT32)(time(NULL) - m_lastRTUpdate) > g_dwRoutingTableUpdateInterval);
 }
 
@@ -2067,63 +2048,30 @@ inline bool Node::isReadyForTopologyPoll()
                return false;
    return (m_status != STATUS_UNMANAGED) &&
               (!(m_flags & NF_DISABLE_TOPOLOGY_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_QUEUED_FOR_TOPOLOGY_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_POLLING_DISABLED)) &&
-          (m_dwDynamicFlags & NDF_CONFIGURATION_POLL_PASSED) &&
+          (!(m_runtimeFlags & NDF_QUEUED_FOR_TOPOLOGY_POLL)) &&
+          (!(m_runtimeFlags & DCDF_DELETE_IN_PROGRESS)) &&
+          (m_runtimeFlags & DCDF_CONFIGURATION_POLL_PASSED) &&
           ((UINT32)(time(NULL) - m_lastTopologyPoll) > g_dwTopologyPollingInterval);
 }
 
-inline bool Node::isReadyForInstancePoll()
-{
-       if (m_isDeleted)
-               return false;
-   return (m_status != STATUS_UNMANAGED) &&
-              (!(m_flags & NF_DISABLE_CONF_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_QUEUED_FOR_INSTANCE_POLL)) &&
-          (!(m_dwDynamicFlags & NDF_POLLING_DISABLED)) &&
-          (m_dwDynamicFlags & NDF_CONFIGURATION_POLL_PASSED) &&
-          ((UINT32)(time(NULL) - m_lastInstancePoll) > g_instancePollingInterval);
-}
-
-inline void Node::lockForStatusPoll()
-{
-   lockProperties();
-   m_dwDynamicFlags |= NDF_QUEUED_FOR_STATUS_POLL;
-   unlockProperties();
-}
-
-inline void Node::lockForConfigurationPoll()
-{
-   lockProperties();
-   m_dwDynamicFlags |= NDF_QUEUED_FOR_CONFIG_POLL;
-   unlockProperties();
-}
-
-inline void Node::lockForInstancePoll()
-{
-   lockProperties();
-   m_dwDynamicFlags |= NDF_QUEUED_FOR_INSTANCE_POLL;
-   unlockProperties();
-}
-
 inline void Node::lockForDiscoveryPoll()
 {
    lockProperties();
-   m_dwDynamicFlags |= NDF_QUEUED_FOR_DISCOVERY_POLL;
+   m_runtimeFlags |= NDF_QUEUED_FOR_DISCOVERY_POLL;
    unlockProperties();
 }
 
 inline void Node::lockForTopologyPoll()
 {
    lockProperties();
-   m_dwDynamicFlags |= NDF_QUEUED_FOR_TOPOLOGY_POLL;
+   m_runtimeFlags |= NDF_QUEUED_FOR_TOPOLOGY_POLL;
    unlockProperties();
 }
 
 inline void Node::lockForRoutePoll()
 {
    lockProperties();
-   m_dwDynamicFlags |= NDF_QUEUED_FOR_ROUTE_POLL;
+   m_runtimeFlags |= NDF_QUEUED_FOR_ROUTE_POLL;
    unlockProperties();
 }
 
@@ -2227,7 +2175,6 @@ private:
    UINT32 m_dwChildIdListSize;
 
 protected:
-       UINT32 m_flags;
        NXSL_Program *m_bindFilter;
        TCHAR *m_bindFilterSource;
 
@@ -2594,7 +2541,6 @@ protected:
        IntegerArray<UINT32> *m_seedObjects;
        int m_discoveryRadius;
        int m_layout;
-       UINT32 m_flags;
        int m_backgroundColor;
        int m_defaultLinkColor;
        int m_defaultLinkRouting;
index 7b151e8..4a8d6c0 100644 (file)
@@ -599,6 +599,265 @@ static bool SetSchemaVersion(int version)
    return SQLQuery(query);
 }
 
+BOOL moveFlagsFromOldTables(const TCHAR *tableName)
+{
+   //_tprintf(_T("Move flags from %s\n"), tableName);
+   TCHAR query[256];
+   _sntprintf(query, 256, _T("SELECT id,flags FROM %s"), tableName);
+   DB_RESULT hResult = DBSelect(g_hCoreDB, query);
+   DB_STATEMENT hStmt = DBPrepare(g_hCoreDB, _T("UPDATE object_properties SET flags=? WHERE object_id=?"));
+   if (hResult != NULL)
+   {
+      if (hStmt != NULL)
+      {
+         int nRows = DBGetNumRows(hResult);
+         for(int i = 0; i < nRows; i++)
+         {
+            DBBind(hStmt, 1, DB_SQLTYPE_INTEGER, DBGetFieldULong(hResult, i, 1));
+            DBBind(hStmt, 2, DB_SQLTYPE_INTEGER, DBGetFieldULong(hResult, i, 0));
+
+            if (!SQLExecute(hStmt))
+            {
+               if (!g_bIgnoreErrors)
+               {
+                  DBFreeStatement(hStmt);
+                  DBFreeResult(hResult);
+                  return FALSE;
+               }
+            }
+         }
+         DBFreeStatement(hStmt);
+      }
+      else if (!g_bIgnoreErrors)
+      {
+         return FALSE;
+      }
+      DBFreeResult(hResult);
+   }
+   else if (!g_bIgnoreErrors)
+   {
+      return FALSE;
+   }
+
+
+   CHK_EXEC(DBDropColumn(g_hCoreDB, tableName, _T("flags")));
+   return TRUE;
+}
+
+//#define FLAG_MOVE(oldVar, newVar, oldFlag, newFlag)  *newVar |= (oldVar & oldFlag > 0) ? newFlag : 0
+
+inline void FLAG_MOVE(UINT32 oldVar, UINT32 *newVar, UINT32 oldFlag, UINT32 newFlag)
+{
+   *newVar |= (oldVar & oldFlag > 0) ? newFlag : 0;
+}
+
+static void moveNodeFlags(UINT32 oldFlag, UINT32 *flags)
+{
+   FLAG_MOVE(oldFlag, flags, 0x10000000, DCF_DISABLE_STATUS_POLL);
+   FLAG_MOVE(oldFlag, flags, 0x20000000, DCF_DISABLE_CONF_POLL);
+   FLAG_MOVE(oldFlag, flags, 0x80000000, DCF_DISABLE_DATA_COLLECT);
+   FLAG_MOVE(oldFlag, flags, 0x00000080, NF_REMOTE_AGENT);
+   FLAG_MOVE(oldFlag, flags, 0x00400000, NF_DISABLE_DISCOVERY_POLL);
+   FLAG_MOVE(oldFlag, flags, 0x00800000, NF_DISABLE_TOPOLOGY_POLL);
+   FLAG_MOVE(oldFlag, flags, 0x01000000, NF_DISABLE_SNMP);
+   FLAG_MOVE(oldFlag, flags, 0x02000000, NF_DISABLE_NXCP);
+   FLAG_MOVE(oldFlag, flags, 0x04000000, NF_DISABLE_ICMP);
+   FLAG_MOVE(oldFlag, flags, 0x08000000, NF_FORCE_ENCRYPTION);
+   FLAG_MOVE(oldFlag, flags, 0x40000000, NF_DISABLE_ROUTE_POLL);
+}
+
+static void moveNodeCapabilities(UINT32 oldFlag, UINT32 *capabilities)
+{
+   FLAG_MOVE(oldFlag, capabilities, 0x00000001, NC_IS_SNMP);
+   FLAG_MOVE(oldFlag, capabilities, 0x00000002, NC_IS_NATIVE_AGENT);
+   FLAG_MOVE(oldFlag, capabilities, 0x00000004, NC_IS_BRIDGE);
+   FLAG_MOVE(oldFlag, capabilities, 0x00000008, NC_IS_ROUTER);
+   FLAG_MOVE(oldFlag, capabilities, 0x00000010, NC_IS_LOCAL_MGMT);
+   FLAG_MOVE(oldFlag, capabilities, 0x00000020, NC_IS_PRINTER);
+   FLAG_MOVE(oldFlag, capabilities, 0x00000040, NC_IS_OSPF);
+   FLAG_MOVE(oldFlag, capabilities, 0x00000100, NC_IS_CPSNMP);
+   FLAG_MOVE(oldFlag, capabilities, 0x00000200, NC_IS_CDP);
+   FLAG_MOVE(oldFlag, capabilities, 0x00000400, NC_IS_NDP);
+   FLAG_MOVE(oldFlag, capabilities, 0x00000800, NC_IS_LLDP);
+   FLAG_MOVE(oldFlag, capabilities, 0x00001000, NC_IS_VRRP);
+   FLAG_MOVE(oldFlag, capabilities, 0x00002000, NC_HAS_VLANS);
+   FLAG_MOVE(oldFlag, capabilities, 0x00004000, NC_IS_8021X);
+   FLAG_MOVE(oldFlag, capabilities, 0x00008000, NC_IS_STP);
+   FLAG_MOVE(oldFlag, capabilities, 0x00010000, NC_HAS_ENTITY_MIB);
+   FLAG_MOVE(oldFlag, capabilities, 0x00020000, NC_HAS_IFXTABLE);
+   FLAG_MOVE(oldFlag, capabilities, 0x00040000, NC_HAS_AGENT_IFXCOUNTERS);
+   FLAG_MOVE(oldFlag, capabilities, 0x00080000, NC_HAS_WINPDH);
+   FLAG_MOVE(oldFlag, capabilities, 0x00100000, NC_IS_WIFI_CONTROLLER);
+   FLAG_MOVE(oldFlag, capabilities, 0x00200000, NC_IS_SMCLP);
+}
+
+static void moveNodeState(UINT32 oldRuntime, UINT32 *state)
+{
+   FLAG_MOVE(oldRuntime, state, 0x000004, NSF_UNREACHABLE);
+   FLAG_MOVE(oldRuntime, state, 0x000008, NSF_AGENT_UNREACHABLE);
+   FLAG_MOVE(oldRuntime, state, 0x000010, NSF_SNMP_UNREACHABLE);
+   FLAG_MOVE(oldRuntime, state, 0x000200, NSF_CPSNMP_UNREACHABLE);
+   FLAG_MOVE(oldRuntime, state, 0x008000, NSF_NETWORK_PATH_PROBLEM);
+   FLAG_MOVE(oldRuntime, state, 0x020000, NSF_CACHE_MODE_NOT_SUPPORTED);
+}
+
+static void moveSensorState(UINT32 oldFlag, UINT32 oldRuntime, UINT32 *status)
+{
+   FLAG_MOVE(oldFlag, status, 0x00000001, SSF_PROVISIONED);
+   FLAG_MOVE(oldFlag, status, 0x00000002, SSF_REGISTERED);
+   FLAG_MOVE(oldFlag, status, 0x00000004, SSF_ACTIVE);
+   FLAG_MOVE(oldFlag, status, 0x00000008, SSF_CONF_UPDATE_PENDING);
+   FLAG_MOVE(oldRuntime, status, 0x000004, SSF_AGENT_UNREACHABLE);
+}
+
+/**
+ * Upgrade from V501 to V502
+ */
+static BOOL H_UpgradeFromV501(int currVersion, int newVersion)
+{
+   //create required columns in netobj table
+   static const TCHAR *batch =
+            _T("ALTER TABLE object_properties ADD flags integer null\n")
+            _T("ALTER TABLE object_properties ADD state integer null\n")
+            _T("ALTER TABLE nodes ADD capabilities integer null\n")
+            _T("UPDATE object_properties set flags=0,state=0\n")
+            _T("<END>");
+   CHK_EXEC(SQLBatch(batch));
+   //move flags from old tables to the new one
+   CHK_EXEC(moveFlagsFromOldTables(_T("interfaces")));
+   CHK_EXEC(moveFlagsFromOldTables(_T("templates")));
+   CHK_EXEC(moveFlagsFromOldTables(_T("chassis")));
+   CHK_EXEC(moveFlagsFromOldTables(_T("object_containers")));
+   CHK_EXEC(moveFlagsFromOldTables(_T("network_maps")));
+   //create special befaviour for node and sensor, cluster
+   //node
+   DB_RESULT hResult = DBSelect(g_hCoreDB, _T("SELECT id,runtime_flags FROM nodes"));
+   DB_STATEMENT stmtNetObj = DBPrepare(g_hCoreDB, _T("UPDATE object_properties SET flags=?, state=? WHERE object_id=?"));
+   DB_STATEMENT stmtNode = DBPrepare(g_hCoreDB, _T("UPDATE nodes SET capabilities=? WHERE id=?"));
+   if (hResult != NULL)
+   {
+      if (stmtNetObj != NULL && stmtNode != NULL)
+      {
+         int nRows = DBGetNumRows(hResult);
+         for(int i = 0; i < nRows; i++)
+         {
+            UINT32 id = DBGetFieldULong(hResult, i, 0);
+            UINT32 oldFlags = 0;
+            UINT32 oldRuntime = DBGetFieldULong(hResult, i, 1);
+            UINT32 flags = 0;
+            UINT32 state = 0;
+            UINT32 capabilities = 0;
+            TCHAR query[256];
+            _sntprintf(query, 256, _T("SELECT node_flags FROM nodes WHERE id=%d"), id);
+            DB_RESULT flagResult = DBSelect(g_hCoreDB, query);
+            if(DBGetNumRows(flagResult) >= 1)
+            {
+               oldFlags = DBGetFieldULong(flagResult, i, 0);
+            }
+            else
+            {
+               if(!g_bIgnoreErrors)
+               {
+                  DBFreeStatement(stmtNetObj);
+                  DBFreeStatement(stmtNode);
+                  DBFreeResult(hResult);
+                  return FALSE;
+               }
+            }
+            moveNodeFlags(oldFlags, &flags);
+            moveNodeCapabilities(oldFlags, &capabilities);
+            moveNodeState(oldRuntime, &state);
+
+            DBBind(stmtNetObj, 1, DB_SQLTYPE_INTEGER, flags);
+            DBBind(stmtNetObj, 2, DB_SQLTYPE_INTEGER, state);
+            DBBind(stmtNetObj, 3, DB_SQLTYPE_INTEGER, id);
+
+            DBBind(stmtNode, 1, DB_SQLTYPE_INTEGER, capabilities);
+            DBBind(stmtNode, 2, DB_SQLTYPE_INTEGER, id);
+
+            if (!(SQLExecute(stmtNetObj)))