outdated object image stuff removed
authorVictor Kirhenshtein <victor@netxms.org>
Thu, 14 May 2009 08:19:11 +0000 (08:19 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Thu, 14 May 2009 08:19:11 +0000 (08:19 +0000)
23 files changed:
doc/internal/db_format_change.txt
include/netxmsdb.h
include/nms_cscp.h
include/nxclapi.h
include/nximage.h [deleted file]
sql/schema.in
src/libnxcl/Makefile.am
src/libnxcl/image.cpp [deleted file]
src/libnxcl/libnxcl.vcproj
src/libnxcl/libnxclw.vcproj
src/libnxcl/objects.cpp
src/server/core/Makefile.am
src/server/core/agent_policy.cpp
src/server/core/id.cpp
src/server/core/image.cpp [deleted file]
src/server/core/main.cpp
src/server/core/netobj.cpp
src/server/core/nxcore.vcproj
src/server/core/session.cpp
src/server/include/nms_core.h
src/server/include/nms_objects.h
src/server/tools/nxdbmgr/export.cpp
src/server/tools/nxdbmgr/upgrade.cpp

index 9a2fd1a..aea5359 100644 (file)
@@ -1,4 +1,11 @@
 *************
+* 91 ==> 92 *
+*************
+
+- Tables dropped: images, default_images
+
+
+*************
 * 90 ==> 91 *
 *************
 
index e489903..f4c2d93 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef _netxmsdb_h
 #define _netxmsdb_h
 
-#define DB_FORMAT_VERSION   91
+#define DB_FORMAT_VERSION   92
 
 #endif
index d6fe32d..0fa7c85 100644 (file)
@@ -301,16 +301,16 @@ typedef struct
 #define CMD_EVENT_NAME_LIST         0x0039
 #define CMD_BIND_OBJECT             0x003A
 #define CMD_UNBIND_OBJECT           0x003B
-#define CMD_GET_IMAGE_LIST          0x003C
-#define CMD_LOAD_IMAGE_FILE         0x003D
-#define CMD_IMAGE_LIST              0x003E
-#define CMD_IMAGE_FILE              0x003F
+//#define CMD_GET_IMAGE_LIST          0x003C
+//#define CMD_LOAD_IMAGE_FILE         0x003D
+//#define CMD_IMAGE_LIST              0x003E
+//#define CMD_IMAGE_FILE              0x003F
 #define CMD_AUTHENTICATE            0x0040
 #define CMD_GET_PARAMETER           0x0041
 #define CMD_GET_LIST                0x0042
 #define CMD_ACTION                  0x0043
-#define CMD_GET_DEFAULT_IMAGE_LIST  0x0044
-#define CMD_DEFAULT_IMAGE_LIST      0x0045
+//#define CMD_GET_DEFAULT_IMAGE_LIST  0x0044
+//#define CMD_DEFAULT_IMAGE_LIST      0x0045
 #define CMD_GET_ALL_ALARMS          0x0046
 #define CMD_GET_ALARM               0x0047
 #define CMD_ACK_ALARM               0x0048
@@ -562,18 +562,18 @@ typedef struct
 #define VID_EVENT_NAME_TABLE        ((DWORD)77)
 #define VID_PARENT_ID               ((DWORD)78)
 #define VID_CHILD_ID                ((DWORD)79)
-#define VID_IMAGE_ID                ((DWORD)80)
-#define VID_NUM_IMAGES              ((DWORD)81)
+//#define VID_IMAGE_ID                ((DWORD)80)
+//#define VID_NUM_IMAGES              ((DWORD)81)
 #define VID_COMMENTS                ((DWORD)82)
-#define VID_IMAGE_FILE_SIZE         ((DWORD)83)
-#define VID_IMAGE_FILE              ((DWORD)84)
+//#define VID_IMAGE_FILE_SIZE         ((DWORD)83)
+//#define VID_IMAGE_FILE              ((DWORD)84)
 #define VID_PARAMETER               ((DWORD)85)
 #define VID_NUM_STRINGS             ((DWORD)86)
 #define VID_ACTION_NAME             ((DWORD)87)
 #define VID_NUM_ARGS                ((DWORD)88)
-#define VID_IMAGE_ID_LIST           ((DWORD)89)
+//#define VID_IMAGE_ID_LIST           ((DWORD)89)
 #define VID_CLASS_ID_LIST           ((DWORD)90)
-#define VID_IMAGE_FORMAT            ((DWORD)91)
+//#define VID_IMAGE_FORMAT            ((DWORD)91)
 #define VID_NOTIFICATION_DATA       ((DWORD)92)
 #define VID_ALARM_ID                ((DWORD)93)
 #define VID_TIMESTAMP               ((DWORD)94)
@@ -922,9 +922,6 @@ typedef struct
 #define VID_DCI_LIST_BASE           ((DWORD)0x40000000)
 #define VID_DCI_LIST_LAST           ((DWORD)0x4FFFFFFF)
 
-// Base value for image list
-#define VID_IMAGE_LIST_BASE         ((DWORD)0x10000000)
-
 // Base value for DCI push data
 #define VID_PUSH_DCI_DATA_BASE      ((DWORD)0x10000000)
 
index 66ec826..0d4a5cf 100644 (file)
@@ -28,7 +28,6 @@
 #include <nms_common.h>
 #include <nms_util.h>
 #include <nxevent.h>
-#include <nximage.h>
 #include <nxcpapi.h>
 #include <nxtools.h>
 #include <nxlog.h>
@@ -91,14 +90,6 @@ typedef void * NXC_SESSION;
 
 
 //
-// Image formats
-//
-
-#define IMAGE_FORMAT_ICO      0
-#define IMAGE_FORMAT_PNG      1
-
-
-//
 // Authentication methods
 //
 
@@ -449,7 +440,7 @@ enum
 #define OBJ_UPDATE_SNMP_VERSION     ((QWORD)_ULL(0x0000000010))
 #define OBJ_UPDATE_SNMP_COMMUNITY   ((QWORD)_ULL(0x0000000020))
 #define OBJ_UPDATE_ACL              ((QWORD)_ULL(0x0000000040))
-#define OBJ_UPDATE_IMAGE            ((QWORD)_ULL(0x0000000080))
+//#define OBJ_UPDATE_IMAGE            ((QWORD)_ULL(0x0000000080))
 #define OBJ_UPDATE_SYNC_NETS        ((QWORD)_ULL(0x0000000100))
 #define OBJ_UPDATE_SERVICE_TYPE     ((QWORD)_ULL(0x0000000200))
 #define OBJ_UPDATE_IP_PROTO         ((QWORD)_ULL(0x0000000400))
@@ -791,29 +782,6 @@ typedef struct
 
 
 //
-// Image information
-//
-
-typedef struct
-{
-   DWORD dwId;
-   TCHAR szName[MAX_OBJECT_NAME];
-   BYTE hash[MD5_DIGEST_SIZE];
-} NXC_IMAGE;
-
-
-//
-// Image list
-//
-
-typedef struct
-{
-   DWORD dwNumImages;
-   NXC_IMAGE *pImageList;
-} NXC_IMAGE_LIST;
-
-
-//
 // Trap parameter mapping entry
 //
 
@@ -1098,7 +1066,6 @@ typedef struct
    BOOL bInheritRights;
    DWORD dwAclSize;
    NXC_ACL_ENTRY *pAccessList;
-   DWORD dwImage;       // Image ID or IMG_DEFAULT for default image
    int iStatusCalcAlg;  // Status calculation algorithm
    int iStatusPropAlg;  // Status propagation alhorithm
    int iFixedStatus;    // Status to be propagated if alg = SA_PROPAGATE_FIXED
@@ -1144,7 +1111,6 @@ typedef struct
    const TCHAR *pszSecret;
    const TCHAR *pszCommunity;
    BOOL bInheritRights;
-   DWORD dwImage;
    DWORD dwAclSize;
    NXC_ACL_ENTRY *pAccessList;
    WORD wSNMPVersion;
@@ -1434,7 +1400,6 @@ typedef struct
 typedef struct
 {
    DWORD dwId;
-   DWORD dwImageId;
    TCHAR szName[MAX_OBJECT_NAME];
    TCHAR *pszDescription;
 } NXC_CONTAINER_CATEGORY;
@@ -1970,13 +1935,6 @@ void LIBNXCL_EXPORTABLE NXCDeletePolicyRule(NXC_EPP *pEventPolicy, DWORD dwRule)
 NXC_EPP_RULE LIBNXCL_EXPORTABLE *NXCCopyEventPolicyRule(NXC_EPP_RULE *src);
 void LIBNXCL_EXPORTABLE NXCCopyEventPolicyRuleToBuffer(NXC_EPP_RULE *dst, NXC_EPP_RULE *src);
 
-/** Images **/
-DWORD LIBNXCL_EXPORTABLE NXCSyncImages(NXC_SESSION hSession, NXC_IMAGE_LIST **ppImageList, TCHAR *pszCacheDir, WORD wFormat);
-DWORD LIBNXCL_EXPORTABLE NXCLoadImageFile(NXC_SESSION hSession, DWORD dwImageId, TCHAR *pszCacheDir, WORD wFormat);
-void LIBNXCL_EXPORTABLE NXCDestroyImageList(NXC_IMAGE_LIST *pImageList);
-DWORD LIBNXCL_EXPORTABLE NXCLoadDefaultImageList(NXC_SESSION hSession, DWORD *pdwListSize,
-                                                 DWORD **ppdwClassId, DWORD **ppdwImageId);
-
 /** Alarms **/
 DWORD LIBNXCL_EXPORTABLE NXCLoadAllAlarms(NXC_SESSION hSession, BOOL bIncludeAck, DWORD *pdwNumAlarms, NXC_ALARM **ppAlarmList);
 DWORD LIBNXCL_EXPORTABLE NXCAcknowledgeAlarm(NXC_SESSION hSession, DWORD dwAlarmId);
diff --git a/include/nximage.h b/include/nximage.h
deleted file mode 100644 (file)
index c2bc015..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* 
-** NetXMS - Network Management System
-** Copyright (C) 2003, 2004 Victor Kirhenshtein
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-** $module: nximage.h
-**
-**/
-
-#ifndef _nximage_h_
-#define _nximage_h_
-
-
-//
-// Default object image IDs
-//
-
-#define IMG_DEFAULT                 0
-#define IMG_NETWORK                 1
-#define IMG_INTERFACE               2
-#define IMG_NODE_GENERIC            3
-#define IMG_PRINTER_GENERIC         4
-#define IMG_CONTAINER_NODE_GROUP    5
-#define IMG_SUBNET                  6
-#define IMG_SERVICE_ROOT            7
-#define IMG_CONTAINER_SERVICE       8
-#define IMG_TEMPLATE                9
-#define IMG_TEMPLATE_GROUP          10
-#define IMG_TEMPLATE_ROOT           11
-#define IMG_NETWORK_SERVICE         12
-#define IMG_ZONE                    13
-#define IMG_VPN_CONNECTOR           14
-#define IMG_CONDITION               15
-#define IMG_CLUSTER                 16
-
-#endif
index 0692af1..68885d8 100644 (file)
@@ -807,34 +807,6 @@ CREATE INDEX idx_alarm_notes_alarm_id ON alarm_notes(alarm_id);
 
 
 /*
-** Image catalog
-*/
-
-CREATE TABLE images
-(
-       image_id integer not null,
-       name varchar(64),
-       file_name_png varchar(255),
-       file_hash_png varchar(32),
-       file_name_ico varchar(255),
-       file_hash_ico varchar(32),
-       PRIMARY KEY(image_id)
-) TABLE_TYPE;
-
-
-/*
-** Default images for various object classes
-*/
-
-CREATE TABLE default_images
-(
-       object_class integer not null,
-       image_id integer not null,
-       PRIMARY KEY(object_class)
-) TABLE_TYPE;
-
-
-/*
 ** OID to node type translation
 */
 
index 5e21c40..7d6689f 100644 (file)
@@ -2,7 +2,7 @@ INCLUDES=-I@top_srcdir@/include
 
 SOURCES = actions.cpp agentcfg.cpp alarms.cpp cert.cpp comm.cpp \
           datacoll.cpp epp.cpp eventdb.cpp events.cpp graph.cpp \
-          image.cpp layer2.cpp main.cpp map.cpp mib.cpp \
+          layer2.cpp main.cpp map.cpp mib.cpp \
           mp.cpp objects.cpp objtools.cpp package.cpp script.cpp \
           server.cpp session.cpp situation.cpp snmptrap.cpp \
          snmp.cpp users.cpp
diff --git a/src/libnxcl/image.cpp b/src/libnxcl/image.cpp
deleted file mode 100644 (file)
index 7def82e..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-/* 
-** NetXMS - Network Management System
-** Client Library
-** Copyright (C) 2004, 2005, 2006, 2007 Victor Kirhenshtein
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-** File: image.cpp
-**
-**/
-
-#include "libnxcl.h"
-
-
-//
-// Download image file from server
-//
-
-DWORD LIBNXCL_EXPORTABLE NXCLoadImageFile(NXC_SESSION hSession, DWORD dwImageId, 
-                                          TCHAR *pszCacheDir, WORD wFormat)
-{
-   DWORD i, dwRqId, dwRetCode, dwFileSize, dwNumBytes;
-   CSCPMessage msg, *pResponse;
-   BYTE *pBuffer;
-   TCHAR cLastChar, szFileName[MAX_PATH];
-   FILE *hFile;
-
-   dwRqId = ((NXCL_Session *)hSession)->CreateRqId();
-
-   msg.SetCode(CMD_LOAD_IMAGE_FILE);
-   msg.SetId(dwRqId);
-   msg.SetVariable(VID_IMAGE_ID, dwImageId);
-   msg.SetVariable(VID_IMAGE_FORMAT, wFormat);
-   ((NXCL_Session *)hSession)->SendMsg(&msg);
-
-   // Loading  file can take time, so we use 60 sec. timeout instead of default
-   pResponse = ((NXCL_Session *)hSession)->WaitForMessage(CMD_IMAGE_FILE, dwRqId, 60000);
-   if (pResponse != NULL)
-   {
-      dwRetCode = pResponse->GetVariableLong(VID_RCC);
-      if (dwRetCode == RCC_SUCCESS)
-      {
-         dwFileSize = pResponse->GetVariableLong(VID_IMAGE_FILE_SIZE);
-         pBuffer = (BYTE *)malloc(dwFileSize);
-         if (pBuffer != NULL)
-         {
-            pResponse->GetVariableBinary(VID_IMAGE_FILE, pBuffer, dwFileSize);
-            cLastChar = pszCacheDir[_tcslen(pszCacheDir) - 1];
-            _sntprintf(szFileName, MAX_PATH, _T("%s%s%08x.%s"), pszCacheDir, 
-                       (cLastChar == _T('\\')) || (cLastChar == _T('/')) ? _T("") : FS_PATH_SEPARATOR, 
-                       dwImageId, (wFormat == IMAGE_FORMAT_PNG) ? _T("png") : _T("ico"));
-#ifndef _WIN32
-                       //umask(0ïîòîì_ïîñ÷èòàþ);
-#endif
-            hFile = _tfopen(szFileName, _T("wb"));
-            if (hFile != NULL)
-            {
-               for(i = 0; i < dwFileSize; i += dwNumBytes)
-               {
-                  dwNumBytes = min(16384, dwFileSize - i);
-                  fwrite(&pBuffer[i], 1, dwNumBytes, hFile);
-               }
-               fclose(hFile);
-            }
-            else
-            {
-               dwRetCode = RCC_IO_ERROR;
-            }
-            free(pBuffer);
-         }
-         else
-         {
-            dwRetCode = RCC_OUT_OF_MEMORY;
-         }
-      }
-      delete pResponse;
-   }
-   else
-   {
-      dwRetCode = RCC_TIMEOUT;
-   }
-
-   return dwRetCode;
-}
-
-
-//
-// Synchronize single image file
-//
-
-static DWORD SyncImageFile(NXC_SESSION hSession, TCHAR *pszCacheDir, 
-                           DWORD dwImageId, BYTE *pServerHash, WORD wFormat)
-{
-   TCHAR szFileName[MAX_PATH];
-   BYTE hash[MD5_DIGEST_SIZE];
-   DWORD dwRetCode = RCC_SUCCESS;
-
-   _sntprintf(szFileName, MAX_PATH, _T("%s") FS_PATH_SEPARATOR _T("%08x.%s"), pszCacheDir, dwImageId,
-              (wFormat == IMAGE_FORMAT_PNG) ? _T("png") : _T("ico"));
-   memset(hash, 0, MD5_DIGEST_SIZE);
-   CalculateFileMD5Hash(szFileName, hash);
-   if (memcmp(hash, pServerHash, MD5_DIGEST_SIZE))
-      // Hash not match, need to download file
-      dwRetCode = NXCLoadImageFile(hSession, dwImageId, pszCacheDir, wFormat);
-   return dwRetCode;
-}
-
-
-//
-// Synchronize images with client
-//
-
-DWORD LIBNXCL_EXPORTABLE NXCSyncImages(NXC_SESSION hSession, NXC_IMAGE_LIST **ppImageList, 
-                                       TCHAR *pszCacheDir, WORD wFormat)
-{
-   DWORD i, dwRqId, dwRetCode, dwId;
-   CSCPMessage msg, *pResponse;
-
-   dwRqId = ((NXCL_Session *)hSession)->CreateRqId();
-
-   msg.SetCode(CMD_GET_IMAGE_LIST);
-   msg.SetId(dwRqId);
-   msg.SetVariable(VID_IMAGE_FORMAT, wFormat);
-   ((NXCL_Session *)hSession)->SendMsg(&msg);
-
-   pResponse = ((NXCL_Session *)hSession)->WaitForMessage(CMD_IMAGE_LIST, dwRqId, 
-                                  ((NXCL_Session *)hSession)->m_dwCommandTimeout * 2);
-   if (pResponse != NULL)
-   {
-      dwRetCode = pResponse->GetVariableLong(VID_RCC);
-      if (dwRetCode == RCC_SUCCESS)
-      {
-         *ppImageList = (NXC_IMAGE_LIST *)malloc(sizeof(NXC_IMAGE_LIST));
-         (*ppImageList)->dwNumImages = pResponse->GetVariableLong(VID_NUM_IMAGES);
-         if ((*ppImageList)->dwNumImages > 0)
-         {
-            (*ppImageList)->pImageList = (NXC_IMAGE *)malloc(sizeof(NXC_IMAGE) * (*ppImageList)->dwNumImages);
-            for(i = 0, dwId = VID_IMAGE_LIST_BASE; i < (*ppImageList)->dwNumImages; i++, dwId += 7)
-            {
-               (*ppImageList)->pImageList[i].dwId = pResponse->GetVariableLong(dwId++);
-               pResponse->GetVariableStr(dwId++, (*ppImageList)->pImageList[i].szName, MAX_OBJECT_NAME);
-               pResponse->GetVariableBinary(dwId++, (*ppImageList)->pImageList[i].hash, MD5_DIGEST_SIZE);
-               dwRetCode = SyncImageFile(hSession, pszCacheDir, 
-                                         (*ppImageList)->pImageList[i].dwId,
-                                         (*ppImageList)->pImageList[i].hash, wFormat);
-               if (dwRetCode != RCC_SUCCESS)
-               {
-                  NXCDestroyImageList(*ppImageList);
-                  break;
-               }
-            }
-         }
-         else
-         {
-            (*ppImageList)->pImageList = NULL;
-         }
-      }
-      delete pResponse;
-   }
-   else
-   {
-      dwRetCode = RCC_TIMEOUT;
-   }
-
-   return dwRetCode;
-}
-
-
-//
-// Destroy image list
-//
-
-void LIBNXCL_EXPORTABLE NXCDestroyImageList(NXC_IMAGE_LIST *pImageList)
-{
-   if (pImageList != NULL)
-   {
-      safe_free(pImageList->pImageList);
-      free(pImageList);
-   }
-}
-
-
-//
-// Load default image list
-//
-
-DWORD LIBNXCL_EXPORTABLE NXCLoadDefaultImageList(NXC_SESSION hSession, DWORD *pdwListSize, 
-                                                 DWORD **ppdwClassId, DWORD **ppdwImageId)
-{
-   CSCPMessage msg, *pResponse;
-   DWORD dwRetCode, dwRqId;
-
-   dwRqId = ((NXCL_Session *)hSession)->CreateRqId();
-
-   msg.SetCode(CMD_GET_DEFAULT_IMAGE_LIST);
-   msg.SetId(dwRqId);
-   ((NXCL_Session *)hSession)->SendMsg(&msg);
-
-   pResponse = ((NXCL_Session *)hSession)->WaitForMessage(CMD_DEFAULT_IMAGE_LIST, dwRqId);
-   if (pResponse != NULL)
-   {
-      dwRetCode = pResponse->GetVariableLong(VID_RCC);
-      if (dwRetCode == RCC_SUCCESS)
-      {
-         *pdwListSize = pResponse->GetVariableLong(VID_NUM_IMAGES);
-         *ppdwClassId = (DWORD *)malloc(sizeof(DWORD) * *pdwListSize);
-         *ppdwImageId = (DWORD *)malloc(sizeof(DWORD) * *pdwListSize);
-         pResponse->GetVariableInt32Array(VID_CLASS_ID_LIST, *pdwListSize, *ppdwClassId);
-         pResponse->GetVariableInt32Array(VID_IMAGE_ID_LIST, *pdwListSize, *ppdwImageId);
-      }
-      delete pResponse;
-   }
-   else
-   {
-      dwRetCode = RCC_TIMEOUT;
-   }
-   return dwRetCode;
-}
index f34daef..becb5b2 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\image.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
                                RelativePath=".\layer2.cpp"\r
                                >\r
                        </File>\r
index cf2977b..3cade3d 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\image.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
                                RelativePath=".\layer2.cpp"\r
                                >\r
                        </File>\r
index 4b72f0c..0b46922 100644 (file)
@@ -201,7 +201,6 @@ static NXC_OBJECT *NewObjectFromMsg(CSCPMessage *pMsg)
    pObject->iStatus = pMsg->GetVariableShort(VID_OBJECT_STATUS);
    pObject->dwIpAddr = pMsg->GetVariableLong(VID_IP_ADDRESS);
    pObject->bIsDeleted = pMsg->GetVariableShort(VID_IS_DELETED);
-   pObject->dwImage = pMsg->GetVariableLong(VID_IMAGE_ID);
    pObject->iStatusCalcAlg = (int)pMsg->GetVariableShort(VID_STATUS_CALCULATION_ALG);
    pObject->iStatusPropAlg = (int)pMsg->GetVariableShort(VID_STATUS_PROPAGATION_ALG);
    pObject->iFixedStatus = (int)pMsg->GetVariableShort(VID_FIXED_STATUS);
@@ -769,8 +768,6 @@ DWORD LIBNXCL_EXPORTABLE NXCModifyObject(NXC_SESSION hSession, NXC_OBJECT_UPDATE
       msg.SetVariable(VID_SHARED_SECRET, pUpdate->pszSecret);
    if (pUpdate->qwFlags & OBJ_UPDATE_SNMP_COMMUNITY)
       msg.SetVariable(VID_COMMUNITY_STRING, pUpdate->pszCommunity);
-   if (pUpdate->qwFlags & OBJ_UPDATE_IMAGE)
-      msg.SetVariable(VID_IMAGE_ID, pUpdate->dwImage);
    if (pUpdate->qwFlags & OBJ_UPDATE_SNMP_VERSION)
       msg.SetVariable(VID_SNMP_VERSION, pUpdate->wSNMPVersion);
    if (pUpdate->qwFlags & OBJ_UPDATE_CHECK_REQUEST)
@@ -1129,8 +1126,6 @@ DWORD LIBNXCL_EXPORTABLE NXCLoadCCList(NXC_SESSION hSession, NXC_CC_LIST **ppLis
             (*ppList)->pElements = (NXC_CONTAINER_CATEGORY *)realloc((*ppList)->pElements, 
                sizeof(NXC_CONTAINER_CATEGORY) * ((*ppList)->dwNumElements + 1));
             (*ppList)->pElements[(*ppList)->dwNumElements].dwId = dwCatId;
-            (*ppList)->pElements[(*ppList)->dwNumElements].dwImageId =
-               pResponse->GetVariableLong(VID_IMAGE_ID);
             pResponse->GetVariableStr(VID_CATEGORY_NAME, 
                (*ppList)->pElements[(*ppList)->dwNumElements].szName, MAX_OBJECT_NAME);
             (*ppList)->pElements[(*ppList)->dwNumElements].pszDescription =
index 6d7d5e6..5392cc3 100644 (file)
@@ -10,7 +10,7 @@ libnxcore_la_SOURCES = acl.cpp agent.cpp agent_policy.cpp actions.cpp \
                        container.cpp correlate.cpp datacoll.cpp \
                        dbwrite.cpp dcitem.cpp dcithreshold.cpp dcivalue.cpp \
                        debug.cpp ef.cpp email.cpp entirenet.cpp epp.cpp \
-                       events.cpp evproc.cpp hk.cpp id.cpp image.cpp \
+                       events.cpp evproc.cpp hk.cpp id.cpp \
                        interface.cpp isc.cpp job.cpp jobmgr.cpp jobqueue.cpp \
                        layer2.cpp locks.cpp \
                        main.cpp map.cpp modules.cpp netinfo.cpp netobj.cpp \
index 28059ec..6b69672 100644 (file)
@@ -54,3 +54,55 @@ AgentPolicy::~AgentPolicy()
 {
        safe_free(m_data);
 }
+
+
+//
+// Save to database
+//
+
+BOOL AgentPolicy::SaveToDB(DB_HANDLE hdb)
+{
+       return FALSE;
+}
+
+
+//
+// Delete from database
+//
+
+BOOL AgentPolicy::DeleteFromDB()
+{
+       return FALSE;
+}
+
+
+//
+// Load from database
+//
+
+BOOL AgentPolicy::CreateFromDB(DWORD dwId)
+{
+       return FALSE;
+}
+
+
+//
+// Create NXCP message with policy data
+//
+
+void AgentPolicy::CreateMessage(CSCPMessage *pMsg)
+{
+}
+
+
+//
+// Modify policy from message
+//
+
+DWORD AgentPolicy::ModifyFromMessage(CSCPMessage *pRequest, BOOL bAlreadyLocked)
+{
+   if (!bAlreadyLocked)
+      LockData();
+
+   return NetObj::ModifyFromMessage(pRequest, TRUE);
+}
index e7e41ad..9ab4d41 100644 (file)
@@ -56,7 +56,7 @@ static const char *m_pszGroupNames[NUMBER_OF_GROUPS] =
    "Events",
    "Data Collection Items",
    "SNMP Trap",
-   "Images",
+   "--Images",
    "Actions",
    "Event Groups",
    "Data Collection Thresholds",
@@ -65,7 +65,7 @@ static const char *m_pszGroupNames[NUMBER_OF_GROUPS] =
    "Alarms",
    "Alarm Notes",
    "Packages",
-   "Log Processing Policies",
+   "--Log Processing Policies",
    "Object Tools",
    "Scripts",
    "Agent Configs",
@@ -264,16 +264,6 @@ BOOL InitIdTable(void)
       DBFreeResult(hResult);
    }
 
-   // Get first available image id
-   hResult = DBSelect(g_hCoreDB, "SELECT max(image_id) FROM images");
-   if (hResult != NULL)
-   {
-      if (DBGetNumRows(hResult) > 0)
-         m_dwFreeIdTable[IDG_IMAGE] = max(m_dwFreeIdTable[IDG_IMAGE], 
-                                          DBGetFieldULong(hResult, 0, 0) + 1);
-      DBFreeResult(hResult);
-   }
-
    // Get first available event identifier
    hResult = DBSelect(g_hCoreDB, "SELECT max(event_id) FROM event_log");
    if (hResult != NULL)
diff --git a/src/server/core/image.cpp b/src/server/core/image.cpp
deleted file mode 100644 (file)
index 2a40306..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-/* 
-** NetXMS - Network Management System
-** Copyright (C) 2003, 2004 Victor Kirhenshtein
-**
-** This program is free software; you can redistribute it and/or modify
-** it under the terms of the GNU General Public License as published by
-** the Free Software Foundation; either version 2 of the License, or
-** (at your option) any later version.
-**
-** This program is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-** GNU General Public License for more details.
-**
-** You should have received a copy of the GNU General Public License
-** along with this program; if not, write to the Free Software
-** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-**
-** $module: image.cpp
-**
-**/
-
-#include "nxcore.h"
-
-
-//
-// Update hashes for image files
-//
-
-void UpdateImageHashes(void)
-{
-   DB_RESULT hResult;
-   int i, iNumImages, iPathLen, iFormat;
-   char szPath[MAX_PATH], szHashText[MD5_DIGEST_SIZE * 2 + 1], szQuery[1024];
-   BYTE hash[MD5_DIGEST_SIZE];
-   DWORD dwImageId;
-   static char szExt[3][4] = { "err", "png", "ico" };
-
-   strcpy(szPath, g_szDataDir);
-   strcat(szPath, DDIR_IMAGES);
-   strcat(szPath, FS_PATH_SEPARATOR);
-   iPathLen = (int)_tcslen(szPath);
-
-   hResult = DBSelect(g_hCoreDB, "SELECT image_id,file_name_png,file_name_ico FROM images");
-   if (hResult != NULL)
-   {
-      iNumImages = DBGetNumRows(hResult);
-      for(i = 0; i < iNumImages; i++)
-      {
-         dwImageId = DBGetFieldULong(hResult, i, 0);
-         for(iFormat = 1; iFormat < 3; iFormat++)
-         {
-            DBGetField(hResult, i, iFormat, &szPath[iPathLen], MAX_PATH - iPathLen);
-            if (CalculateFileMD5Hash(szPath, hash))
-            {
-               // Convert MD5 hash to text form and update database
-               BinToStr(hash, MD5_DIGEST_SIZE, szHashText);
-               sprintf(szQuery, "UPDATE images SET file_hash_%s='%s' WHERE image_id=%d",
-                       szExt[iFormat], szHashText, dwImageId);
-               DBQuery(g_hCoreDB, szQuery);
-            }
-            else
-            {
-               nxlog_write(MSG_IMAGE_FILE_IO_ERROR, EVENTLOG_ERROR_TYPE, "ds", dwImageId, szPath);
-            }
-         }
-      }
-      DBFreeResult(hResult);
-   }
-   else
-   {
-      nxlog_write(MSG_ERROR_READ_IMAGE_CATALOG, EVENTLOG_ERROR_TYPE, NULL);
-   }
-}
-
-
-//
-// Send default images to client
-//
-
-void SendDefaultImageList(ClientSession *pSession, DWORD dwRqId)
-{
-   CSCPMessage msg;
-   DB_RESULT hResult;
-   DWORD i, dwListSize, *pdwClassId, *pdwImageId;
-
-   // Prepare message
-   msg.SetId(dwRqId);
-   msg.SetCode(CMD_DEFAULT_IMAGE_LIST);
-
-   // Load default image list from database
-   hResult = DBSelect(g_hCoreDB, "SELECT object_class,image_id FROM default_images");
-   if (hResult != NULL)
-   {
-      dwListSize = DBGetNumRows(hResult);
-      msg.SetVariable(VID_NUM_IMAGES, dwListSize);
-      
-      pdwClassId = (DWORD *)malloc(sizeof(DWORD) * dwListSize);
-      pdwImageId = (DWORD *)malloc(sizeof(DWORD) * dwListSize);
-      for(i = 0; i < dwListSize; i++)
-      {
-         pdwClassId[i] = DBGetFieldULong(hResult, i, 0);
-         pdwImageId[i] = DBGetFieldULong(hResult, i, 1);
-      }
-      msg.SetVariableToInt32Array(VID_CLASS_ID_LIST, dwListSize, pdwClassId);
-      msg.SetVariableToInt32Array(VID_IMAGE_ID_LIST, dwListSize, pdwImageId);
-      free(pdwClassId);
-      free(pdwImageId);
-
-      msg.SetVariable(VID_RCC, RCC_SUCCESS);
-      DBFreeResult(hResult);
-   }
-   else
-   {
-      msg.SetVariable(VID_RCC, RCC_DB_FAILURE);
-   }
-
-   // Send response
-   pSession->SendMessage(&msg);
-}
-
-
-//
-// Send current image catalogue to client
-//
-
-void SendImageCatalogue(ClientSession *pSession, DWORD dwRqId, WORD wFormat)
-{
-   CSCPMessage msg;
-   DB_RESULT hResult;
-   DWORD i, dwNumImages, dwId;
-   BYTE hash[MD5_DIGEST_SIZE];
-   TCHAR szQuery[256], szHashText[MD5_DIGEST_SIZE * 2 + 1], szBuffer[MAX_DB_STRING];
-
-   // Prepare message
-   msg.SetId(dwRqId);
-   msg.SetCode(CMD_IMAGE_LIST);
-
-   // Load image catalogue from database
-   _stprintf(szQuery, _T("SELECT image_id,name,file_hash_%s FROM images"),
-             (wFormat == IMAGE_FORMAT_PNG) ? _T("png") : _T("ico"));
-   hResult = DBSelect(g_hCoreDB, szQuery);
-   if (hResult != NULL)
-   {
-      dwNumImages = DBGetNumRows(hResult);
-      msg.SetVariable(VID_NUM_IMAGES, dwNumImages);
-      
-      for(i = 0, dwId = VID_IMAGE_LIST_BASE; i < dwNumImages; i++, dwId += 7)
-      {
-         msg.SetVariable(dwId++, DBGetFieldULong(hResult, i, 0));
-         msg.SetVariable(dwId++, DBGetField(hResult, i, 1, szBuffer, MAX_DB_STRING));
-         DBGetField(hResult, i, 2, szHashText, MD5_DIGEST_SIZE * 2 + 1);
-         StrToBin(szHashText, hash, MD5_DIGEST_SIZE);
-         msg.SetVariable(dwId++, hash, MD5_DIGEST_SIZE);
-      }
-
-      msg.SetVariable(VID_RCC, RCC_SUCCESS);
-      DBFreeResult(hResult);
-   }
-   else
-   {
-      msg.SetVariable(VID_RCC, RCC_DB_FAILURE);
-   }
-
-   // Send response
-   pSession->SendMessage(&msg);
-}
-
-
-//
-// Send image file to client
-//
-
-void SendImageFile(ClientSession *pSession, DWORD dwRqId, DWORD dwImageId, WORD wFormat)
-{
-   CSCPMessage msg;
-   char szQuery[256], szFileName[MAX_PATH];
-   DB_RESULT hResult;
-   BYTE *pFile;
-   DWORD dwFileSize;
-
-   // Prepare message
-   msg.SetId(dwRqId);
-   msg.SetCode(CMD_IMAGE_FILE);
-
-   sprintf(szQuery, "SELECT file_name_%s FROM images WHERE image_id=%d", 
-           (wFormat == IMAGE_FORMAT_PNG) ? "png" : "ico", dwImageId);
-   hResult = DBSelect(g_hCoreDB, szQuery);
-   if (hResult != NULL)
-   {
-      if (DBGetNumRows(hResult) > 0)
-      {
-         // Load file into memory
-         _tcscpy(szFileName, g_szDataDir);
-         _tcscat(szFileName, DDIR_IMAGES);
-         _tcscat(szFileName, FS_PATH_SEPARATOR);
-         DBGetField(hResult, 0, 0, &szFileName[_tcslen(szFileName)], MAX_PATH - (int)_tcslen(szFileName));
-         pFile = LoadFile(szFileName, &dwFileSize);
-         if (pFile != NULL)
-         {
-            msg.SetVariable(VID_RCC, RCC_SUCCESS);
-            msg.SetVariable(VID_IMAGE_FILE_SIZE, dwFileSize);
-            msg.SetVariable(VID_IMAGE_FILE, pFile, dwFileSize);
-            free(pFile);
-         }
-         else
-         {
-            msg.SetVariable(VID_RCC, RCC_SYSTEM_FAILURE);
-         }
-      }
-      else
-      {
-         msg.SetVariable(VID_RCC, RCC_INVALID_OBJECT_ID);
-      }
-      DBFreeResult(hResult);
-   }
-   else
-   {
-      msg.SetVariable(VID_RCC, RCC_DB_FAILURE);
-   }
-
-   // Send response
-   pSession->SendMessage(&msg);
-}
index 8ddeb80..7698ad7 100644 (file)
@@ -551,9 +551,6 @@ retry_db_lock:
        // Initialize SNMP stuff
        SnmpInit();
 
-       // Update hashes for image files
-       UpdateImageHashes();
-
        // Create synchronization stuff
        m_condShutdown = ConditionCreate(TRUE);
 
index 250f09d..e2d57d6 100644 (file)
@@ -53,7 +53,7 @@ NetObj::NetObj()
    m_bInheritAccessRights = TRUE;
        m_dwNumTrustedNodes = 0;
        m_pdwTrustedNodes = NULL;
-   m_dwImageId = IMG_DEFAULT;    // Default image
+   m_dwImageId = 0;    // Default image
    m_pPollRequestor = NULL;
    m_iStatusCalcAlg = SA_CALCULATE_DEFAULT;
    m_iStatusPropAlg = SA_PROPAGATE_DEFAULT;
@@ -747,7 +747,6 @@ void NetObj::CreateMessage(CSCPMessage *pMsg)
    for(i = 0, dwId = VID_CHILD_ID_BASE; i < m_dwChildCount; i++, dwId++)
       pMsg->SetVariable(dwId, m_pChildList[i]->Id());
    pMsg->SetVariable(VID_INHERIT_RIGHTS, (WORD)m_bInheritAccessRights);
-   pMsg->SetVariable(VID_IMAGE_ID, m_dwImageId);
    pMsg->SetVariable(VID_STATUS_CALCULATION_ALG, (WORD)m_iStatusCalcAlg);
    pMsg->SetVariable(VID_STATUS_PROPAGATION_ALG, (WORD)m_iStatusPropAlg);
    pMsg->SetVariable(VID_FIXED_STATUS, (WORD)m_iFixedStatus);
@@ -822,10 +821,6 @@ DWORD NetObj::ModifyFromMessage(CSCPMessage *pRequest, BOOL bAlreadyLocked)
    if (pRequest->IsVariableExist(VID_OBJECT_NAME))
       pRequest->GetVariableStr(VID_OBJECT_NAME, m_szName, MAX_OBJECT_NAME);
 
-   // Change object's image (icon)
-   if (pRequest->IsVariableExist(VID_IMAGE_ID))
-      m_dwImageId = pRequest->GetVariableLong(VID_IMAGE_ID);
-
    // Change object's status calculation/propagation algorithms
    if (pRequest->IsVariableExist(VID_STATUS_CALCULATION_ALG))
    {
index 30b64a3..d5d5680 100644 (file)
                                >\r
                        </File>\r
                        <File\r
-                               RelativePath=".\image.cpp"\r
-                               >\r
-                       </File>\r
-                       <File\r
                                RelativePath=".\interface.cpp"\r
                                >\r
                        </File>\r
index e89fc32..a5bce6e 100644 (file)
@@ -829,16 +829,6 @@ void ClientSession::ProcessingThread(void)
          case CMD_UNBIND_OBJECT:
             ChangeObjectBinding(pMsg, FALSE);
             break;
-         case CMD_GET_IMAGE_LIST:
-            SendImageCatalogue(this, pMsg->GetId(), pMsg->GetVariableShort(VID_IMAGE_FORMAT));
-            break;
-         case CMD_LOAD_IMAGE_FILE:
-            SendImageFile(this, pMsg->GetId(), pMsg->GetVariableLong(VID_IMAGE_ID),
-                          pMsg->GetVariableShort(VID_IMAGE_FORMAT));
-            break;
-         case CMD_GET_DEFAULT_IMAGE_LIST:
-            SendDefaultImageList(this, pMsg->GetId());
-            break;
          case CMD_GET_ALL_ALARMS:
             SendAllAlarms(pMsg->GetId(), pMsg->GetVariableShort(VID_IS_ACK));
             break;
@@ -4238,7 +4228,7 @@ void ClientSession::SendContainerCategories(DWORD dwRqId)
    {
       msg.SetVariable(VID_CATEGORY_ID, g_pContainerCatList[i].dwCatId);
       msg.SetVariable(VID_CATEGORY_NAME, g_pContainerCatList[i].szName);
-      msg.SetVariable(VID_IMAGE_ID, g_pContainerCatList[i].dwImageId);
+      //msg.SetVariable(VID_IMAGE_ID, g_pContainerCatList[i].dwImageId);
       msg.SetVariable(VID_DESCRIPTION, g_pContainerCatList[i].pszDescription);
       SendMessage(&msg);
       msg.DeleteAllVariables();
index 4196c1e..3303fa5 100644 (file)
@@ -69,7 +69,6 @@
 #include <nms_cscp.h>
 #include <uuid.h>
 #include <nxsrvapi.h>
-#include <nximage.h>
 #include <nxqueue.h>
 #include <nxsnmp.h>
 #include <nxmodule.h>
@@ -127,7 +126,7 @@ typedef void * HSNMPSESSION;
 #define IDG_EVENT             2
 #define IDG_ITEM              3
 #define IDG_SNMP_TRAP         4
-#define IDG_IMAGE             5
+//#define IDG_IMAGE             5
 #define IDG_ACTION            6
 #define IDG_EVENT_GROUP       7
 #define IDG_THRESHOLD         8
@@ -676,11 +675,6 @@ BOOL InitIdTable(void);
 DWORD CreateUniqueId(int iGroup);
 QWORD CreateUniqueEventId(void);
 
-void UpdateImageHashes(void);
-void SendImageCatalogue(ClientSession *pSession, DWORD dwRqId, WORD wFormat);
-void SendImageFile(ClientSession *pSession, DWORD dwRqId, DWORD dwImageId, WORD wFormat);
-void SendDefaultImageList(ClientSession *pSession, DWORD dwRqId);
-
 void InitMailer(void);
 void ShutdownMailer(void);
 void NXCORE_EXPORTABLE PostMail(char *pszRcpt, char *pszSubject, char *pszText);
index 86f4654..65ac686 100644 (file)
@@ -1139,6 +1139,15 @@ protected:
 public:
    AgentPolicy(int type);
    virtual ~AgentPolicy();
+
+   virtual int Type(void) { return OBJECT_AGENTPOLICY; }
+
+   virtual BOOL SaveToDB(DB_HANDLE hdb);
+   virtual BOOL DeleteFromDB(void);
+   virtual BOOL CreateFromDB(DWORD dwId);
+
+   virtual void CreateMessage(CSCPMessage *pMsg);
+   virtual DWORD ModifyFromMessage(CSCPMessage *pRequest, BOOL bAlreadyLocked = FALSE);
 };
 
 
index 7ae8d1f..d29b26e 100644 (file)
@@ -79,8 +79,6 @@ const TCHAR *g_tables[] =
        "deleted_objects",
        "alarms",
        "alarm_notes",
-       "images",
-       "default_images",
        "oid_to_type",
        "snmp_trap_cfg",
        "snmp_trap_pmap",
index d89f18a..4d3092a 100644 (file)
@@ -103,6 +103,29 @@ static BOOL SetPrimaryKey(const TCHAR *table, const TCHAR *key)
 
 
 //
+// Upgrade from V91 to V92
+//
+
+static BOOL H_UpgradeFromV91(void)
+{
+       static TCHAR batch[] =
+               _T("DROP TABLE images\n")
+               _T("DROP TABLE default_images\n")
+               _T("<END>");
+               
+       if (!SQLBatch(batch))
+               if (!g_bIgnoreErrors)
+                       return FALSE;
+
+       if (!SQLQuery(_T("UPDATE metadata SET var_value='92' WHERE var_name='SchemaVersion'")))
+      if (!g_bIgnoreErrors)
+         return FALSE;
+
+   return TRUE;
+}
+
+
+//
 // Upgrade from V90 to V91
 //