download file info classes from server and agent refactored with common base class...
authorVictor Kirhenshtein <victor@netxms.org>
Tue, 14 Feb 2017 16:16:02 +0000 (18:16 +0200)
committerVictor Kirhenshtein <victor@netxms.org>
Tue, 14 Feb 2017 16:16:02 +0000 (18:16 +0200)
include/nms_agent.h
src/agent/core/Makefile.am
src/agent/core/Makefile.w32
src/agent/core/nxagentd.h
src/agent/core/session.cpp
src/agent/libnxagent/Makefile.am
src/agent/libnxagent/Makefile.w32
src/agent/libnxagent/dfile_info.cpp [moved from src/agent/core/dfile_info.cpp with 51% similarity]
src/server/core/dfile_info.cpp
src/server/core/session.cpp
src/server/include/nms_core.h

index 3e202df..415d8fd 100644 (file)
@@ -38,6 +38,7 @@
 #include <nms_util.h>
 #include <nxconfig.h>
 #include <nxdbapi.h>
+#include <nxcpapi.h>
 
 /**
  * Initialization function declaration macro
 #define DCTDESC_SYSTEM_OPEN_FILES                 _T("Open files")
 #define DCTDESC_SYSTEM_PROCESSES                  _T("Processes")
 
+/**
+ * Class that stores information about file that will be received
+ */
+class LIBNXAGENT_EXPORTABLE DownloadFileInfo
+{
+protected:
+   TCHAR *m_fileName;
+   time_t m_lastModTime;
+   int m_file;
+   StreamCompressor *m_compressor;  // stream compressor for file transfer
+
+public:
+   DownloadFileInfo(const TCHAR *name, time_t lastModTime = 0);
+   virtual ~DownloadFileInfo();
+
+   virtual bool open();
+   virtual bool write(const BYTE *data, size_t dataSize, bool compressedStream);
+   virtual void close(bool success);
+};
+
 /**
  * API for CommSession
  */
index e0c5e58..40a757e 100644 (file)
@@ -1,7 +1,7 @@
 AM_CPPFLAGS=-I@top_srcdir@/include
 bin_PROGRAMS = nxagentd
 nxagentd_SOURCES = messages.c actions.cpp appagent.cpp comm.cpp config.cpp \
-                   ctrl.cpp datacoll.cpp dcsnmp.cpp dbupgrade.cpp dfile_info.cpp epp.cpp \
+                   ctrl.cpp datacoll.cpp dcsnmp.cpp dbupgrade.cpp epp.cpp \
                    exec.cpp extagent.cpp getparam.cpp localdb.cpp master.cpp \
                    nxagentd.cpp policy.cpp push.cpp register.cpp sa.cpp \
                    sd.cpp session.cpp snmpproxy.cpp snmptrapproxy.cpp \
index c4a1db3..2f653fb 100644 (file)
@@ -2,7 +2,7 @@ TARGET = nxagentd.exe
 TYPE = exe
 SOURCES = \
        actions.cpp appagent.cpp comm.cpp config.cpp \
-       ctrl.cpp datacoll.cpp dcsnmp.cpp dbupgrade.cpp dfile_info.cpp epp.cpp \
+       ctrl.cpp datacoll.cpp dcsnmp.cpp dbupgrade.cpp epp.cpp \
        exec.cpp extagent.cpp getparam.cpp hddinfo.cpp localdb.cpp master.cpp \
        nxagentd.cpp policy.cpp push.cpp register.cpp sa.cpp \
        sd.cpp service.cpp session.cpp snmpproxy.cpp snmptrapproxy.cpp \
index f7c57ca..b257f37 100644 (file)
@@ -302,24 +302,6 @@ struct PendingRequest
    }
 };
 
-/**
- * Class that stores information about file that will be received
- */
-class DownloadFileInfo
-{
-private:
-   TCHAR *m_fileName;
-   time_t m_lastModTime;
-   int m_file;
-
-public:
-   DownloadFileInfo(const TCHAR *name, time_t lastModTime = 0);
-   ~DownloadFileInfo();
-   bool open();
-   bool write(const BYTE *data, int dataSize);
-   void close(bool success);
-};
-
 /**
  * Communication session
  */
@@ -347,7 +329,6 @@ private:
    bool m_ipv6Aware;
    bool m_bulkReconciliationSupported;
    HashMap<UINT32, DownloadFileInfo> m_downloadFileMap;
-   StreamCompressor *m_compressor;  // stream compressor for file transfer
    bool m_allowCompression;   // allow compression for structured messages
        NXCPEncryptionContext *m_pCtx;
    time_t m_ts;               // Last activity timestamp
index 39e0b88..80262a7 100644 (file)
@@ -131,7 +131,6 @@ CommSession::CommSession(SOCKET hSocket, const InetAddress &serverAddr, bool mas
    m_ipv6Aware = false;
    m_bulkReconciliationSupported = false;
    m_disconnected = false;
-   m_compressor = NULL;
    m_allowCompression = false;
    m_pCtx = NULL;
    m_ts = time(NULL);
@@ -163,7 +162,6 @@ CommSession::~CommSession()
       if (p != INVALID_POINTER_VALUE)
          delete (NXCPMessage *)p;
    delete m_processingQueue;
-   delete m_compressor;
        if ((m_pCtx != NULL) && (m_pCtx != PROXY_ENCRYPTION_CTX))
                m_pCtx->decRefCount();
        MutexDestroy(m_socketWriteMutex);
@@ -267,40 +265,7 @@ void CommSession::readThread()
                DownloadFileInfo *dInfo = m_downloadFileMap.get(msg->getId());
                if (dInfo != NULL)
                {
-                  const BYTE *data;
-                  int dataSize;
-                  if (msg->isCompressedStream())
-                  {
-                     const BYTE *in = msg->getBinaryData();
-                     if (m_compressor == NULL)
-                     {
-                        NXCPStreamCompressionMethod method = (NXCPStreamCompressionMethod)(*in);
-                        m_compressor = StreamCompressor::create(method, false, FILE_BUFFER_SIZE);
-                        if (m_compressor == NULL)
-                        {
-                           debugPrintf(5, _T("Unable to create stream compressor for method %d"), (int)method);
-                           data = NULL;
-                           dataSize = -1;
-                        }
-                     }
-
-                     if (m_compressor != NULL)
-                     {
-                        dataSize = (int)m_compressor->decompress(in + 4, msg->getBinaryDataSize() - 4, &data);
-                        if (dataSize != (int)ntohs(*((UINT16 *)(in + 2))))
-                        {
-                           // decompressed block size validation failed
-                           dataSize = -1;
-                        }
-                     }
-                  }
-                  else
-                  {
-                     data = msg->getBinaryData();
-                     dataSize = (int)msg->getBinaryDataSize();
-                  }
-
-                  if ((dataSize >= 0) && dInfo->write(data, dataSize))
+                  if (dInfo->write(msg->getBinaryData(), msg->getBinaryDataSize(), msg->isCompressedStream()))
                   {
                      if (msg->isEndOfFile())
                      {
@@ -308,7 +273,6 @@ void CommSession::readThread()
 
                         dInfo->close(true);
                         m_downloadFileMap.remove(msg->getId());
-                        delete_and_null(m_compressor);
 
                         response.setCode(CMD_REQUEST_COMPLETED);
                         response.setId(msg->getId());
@@ -323,7 +287,6 @@ void CommSession::readThread()
 
                      dInfo->close(false);
                      m_downloadFileMap.remove(msg->getId());
-                     delete_and_null(m_compressor);
 
                      response.setCode(CMD_REQUEST_COMPLETED);
                      response.setId(msg->getId());
index f5ecd23..9c6c74e 100644 (file)
@@ -1,4 +1,4 @@
-SOURCES = bridge.cpp cmdexec.cpp main.cpp registry.cpp tools.cpp
+SOURCES = bridge.cpp cmdexec.cpp dfile_info.cpp main.cpp registry.cpp tools.cpp
 
 lib_LTLIBRARIES = libnxagent.la
 
index 29f5820..a8165cd 100644 (file)
@@ -1,6 +1,6 @@
 TARGET = libnxagent.dll
 TYPE = dll
-SOURCES = bridge.cpp cmdexec.cpp main.cpp registry.cpp tools.cpp
+SOURCES = bridge.cpp cmdexec.cpp dfile_info.cpp main.cpp registry.cpp tools.cpp
 
 CPPFLAGS = /DLIBNXAGENT_EXPORTS
 LIBS = libnxdb.lib libnetxms.lib
similarity index 51%
rename from src/agent/core/dfile_info.cpp
rename to src/agent/libnxagent/dfile_info.cpp
index c5bad46..b6de660 100644 (file)
@@ -20,7 +20,7 @@
 **
 **/
 
-#include "nxagentd.h"
+#include "libnxagent.h"
 
 /**
  * Constructor for DownloadFileInfo class only stores given data
@@ -30,6 +30,7 @@ DownloadFileInfo::DownloadFileInfo(const TCHAR *name, time_t lastModTime)
    m_fileName = _tcsdup(name);
    m_lastModTime = lastModTime;
    m_file = -1;
+   m_compressor = NULL;
 }
 
 /**
@@ -38,8 +39,9 @@ DownloadFileInfo::DownloadFileInfo(const TCHAR *name, time_t lastModTime)
 DownloadFileInfo::~DownloadFileInfo()
 {
    if (m_file != -1)
-      close(false);
-   delete m_fileName;
+      close(m_file);
+   free(m_fileName);
+   delete m_compressor;
 }
 
 /**
@@ -54,9 +56,36 @@ bool DownloadFileInfo::open()
 /**
  * Function that writes incoming data to file
  */
-bool DownloadFileInfo::write(const BYTE *data, int dataSize)
+bool DownloadFileInfo::write(const BYTE *data, size_t dataSize, bool compressedStream)
 {
-   return _write(m_file, data, dataSize) == dataSize;
+   if (!compressedStream)
+      return _write(m_file, data, dataSize) == dataSize;
+
+   if (m_compressor == NULL)
+   {
+      NXCPStreamCompressionMethod method = (NXCPStreamCompressionMethod)(*data);
+      m_compressor = StreamCompressor::create(method, false, FILE_BUFFER_SIZE);
+      if (m_compressor != NULL)
+      {
+         nxlog_debug(5, _T("DownloadFileInfo(%s): created stream compressor for method %d"), m_fileName, (int)method);
+      }
+      else
+      {
+         nxlog_debug(5, _T("DownloadFileInfo(%s): unable to create stream compressor for method %d"), m_fileName, (int)method);
+         return false;
+      }
+   }
+
+   const BYTE *uncompressedData;
+   size_t uncompressedDataSize = m_compressor->decompress(data + 4, dataSize - 4, &uncompressedData);
+   if (uncompressedDataSize != (int)ntohs(*((UINT16 *)(data + 2))))
+   {
+      // decompressed block size validation failed
+      nxlog_debug(5, _T("DownloadFileInfo(%s): decompression failure"), m_fileName);
+      return false;
+   }
+
+   return _write(m_file, uncompressedData, uncompressedDataSize) == uncompressedDataSize;
 }
 
 /**
@@ -67,10 +96,14 @@ void DownloadFileInfo::close(bool success)
    _close(m_file);
    m_file = -1;
 
-   if(m_lastModTime != 0)
-      SetLastModificationTime(m_fileName, m_lastModTime);
-
-   // Remove received file in case of failure
-   if (!success)
+   if (success)
+   {
+      if (m_lastModTime != 0)
+         SetLastModificationTime(m_fileName, m_lastModTime);
+   }
+   else
+   {
+      // Remove received file in case of failure
       _tunlink(m_fileName);
+   }
 }
index 50a9754..1321f92 100644 (file)
 /**
  * Constructor for DownloadFileInfo class only stores given data
  */
-DownloadFileInfo::DownloadFileInfo(const TCHAR *name, UINT32 uploadCommand, time_t lastModTime)
+ServerDownloadFileInfo::ServerDownloadFileInfo(const TCHAR *name, UINT32 uploadCommand, time_t lastModTime) : DownloadFileInfo(name, lastModTime)
 {
-   m_fileName = _tcsdup(name);
    m_uploadCommand = uploadCommand;
    m_uploadData = 0;
-   m_lastModTime = lastModTime;
-   m_file = -1;
 }
 
 /**
  * Destructor
  */
-DownloadFileInfo::~DownloadFileInfo()
+ServerDownloadFileInfo::~ServerDownloadFileInfo()
 {
-   if (m_file != -1)
-      close(false);
-   delete m_fileName;
-}
-
-/**
- * Opens file and returns if it was successfully
- */
-bool DownloadFileInfo::open()
-{
-   m_file = _topen(m_fileName, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, S_IRUSR | S_IWUSR);
-   return m_file != -1;
-}
-
-/**
- * Set upload data for package
- */
-void DownloadFileInfo::setUploadData(UINT32 data)
-{
-   m_uploadData = data;
-}
-/**
- * Set downloadable image guid
- */
-void DownloadFileInfo::setGUID(uuid_t guid)
-{
-   memcpy(m_uploadImageGuid, guid, UUID_LENGTH);
 }
 
 /**
  * Update database information about agent package
  */
-void DownloadFileInfo::updateAgentPkgDBInfo(const TCHAR *description, const TCHAR *pkgName, const TCHAR *pkgVersion, const TCHAR *platform, const TCHAR *cleanFileName)
+void ServerDownloadFileInfo::updateAgentPkgDBInfo(const TCHAR *description, const TCHAR *pkgName, const TCHAR *pkgVersion, const TCHAR *platform, const TCHAR *cleanFileName)
 {
    TCHAR *escDescr = EncodeSQLString(description);
    TCHAR szQuery[2048];
@@ -87,30 +57,20 @@ void DownloadFileInfo::updateAgentPkgDBInfo(const TCHAR *description, const TCHA
    DBConnectionPoolReleaseConnection(hdb);
 }
 
-/**
- * Function that writes incoming data to file
- */
-bool DownloadFileInfo::write(const BYTE *data, int dataSize)
-{
-   return _write(m_file, data, dataSize) == dataSize;
-}
-
-
 /**
  * Callback for sending image library update notifications
  */
 static void ImageLibraryUpdateCallback(ClientSession *pSession, void *pArg)
 {
-       pSession->onLibraryImageChange((uuid_t *)pArg, false);
+       pSession->onLibraryImageChange(*((const uuid *)pArg), false);
 }
 
 /**
  * Closes file and changes it's date if required
  */
-void DownloadFileInfo::close(bool success)
+void ServerDownloadFileInfo::close(bool success)
 {
-   _close(m_file);
-   m_file = -1;
+   DownloadFileInfo::close(success);
 
    switch(m_uploadCommand)
    {
@@ -125,17 +85,10 @@ void DownloadFileInfo::close(bool success)
          }
          break;
       case CMD_MODIFY_IMAGE:
-         EnumerateClientSessions(ImageLibraryUpdateCallback, (void *)&m_uploadImageGuid);
-         break;
-      case CMD_UPLOAD_FILE:
-         if(m_lastModTime != 0)
-            SetLastModificationTime(m_fileName, m_lastModTime);
+         if (success)
+            EnumerateClientSessions(ImageLibraryUpdateCallback, (void *)&m_uploadImageGuid);
          break;
       default:
          break;
    }
-
-   // Remove received file in case of failure
-   if (!success)
-      _tunlink(m_fileName);
 }
index 3c9c6d1..c319f5e 100644 (file)
@@ -97,11 +97,13 @@ typedef struct
 /**
  *
  */
-typedef struct
+struct LIBRARY_IMAGE_UPDATE_INFO
 {
-  uuid_t *guid;
+  uuid guid;
   bool removed;
-} LIBRARY_IMAGE_UPDATE_INFO;
+
+  LIBRARY_IMAGE_UPDATE_INFO(const uuid& _guid, bool _removed) { guid = _guid; removed = _removed; }
+};
 
 /**
  * Callback to delete agent connections for loading files in destructor
@@ -116,7 +118,7 @@ static void DeleteCallback(NetObj* obj, void *data)
  */
 static void ImageLibraryDeleteCallback(ClientSession *pSession, void *pArg)
 {
-       pSession->onLibraryImageChange((uuid_t *)pArg, true);
+       pSession->onLibraryImageChange(*((const uuid *)pArg), true);
 }
 
 /**
@@ -281,7 +283,7 @@ ClientSession::ClientSession(SOCKET hSocket, struct sockaddr *addr)
    m_musicTypeList.add(_T("wav"));
    _tcscpy(m_language, _T("en"));
    m_serverCommands = new HashMap<UINT32, CommandExec>(true);
-   m_downloadFileMap = new HashMap<UINT32, DownloadFileInfo>(true);
+   m_downloadFileMap = new HashMap<UINT32, ServerDownloadFileInfo>(true);
 }
 
 /**
@@ -432,12 +434,12 @@ void ClientSession::readThread()
          if ((msg->getCode() == CMD_FILE_DATA) ||
              (msg->getCode() == CMD_ABORT_FILE_TRANSFER))
          {
-            DownloadFileInfo *dInfo = m_downloadFileMap->get(msg->getId());
+            ServerDownloadFileInfo *dInfo = m_downloadFileMap->get(msg->getId());
             if (dInfo != NULL)
             {
                if (msg->getCode() == CMD_FILE_DATA)
                {
-                  if (dInfo->write(msg->getBinaryData(), (int)msg->getBinaryDataSize()))
+                  if (dInfo->write(msg->getBinaryData(), msg->getBinaryDataSize(), msg->isCompressedStream()))
                   {
                      if (msg->isEndOfFile())
                      {
@@ -706,21 +708,13 @@ void ClientSession::updateThread()
             break;
          case INFO_CAT_LIBRARY_IMAGE:
             {
-              LIBRARY_IMAGE_UPDATE_INFO *info = (LIBRARY_IMAGE_UPDATE_INFO *)pUpdate->pData;
-              msg.setCode(CMD_IMAGE_LIBRARY_UPDATE);
-              msg.setField(VID_GUID, (BYTE *)info->guid, UUID_LENGTH);
-              if (info->removed)
-              {
-                msg.setField(VID_FLAGS, (UINT32)1);
-              }
-              else
-              {
-                msg.setField(VID_FLAGS, (UINT32)0);
-              }
-              sendMessage(&msg);
-              msg.deleteAllFields();
-              free(info->guid);
-              free(info);
+               LIBRARY_IMAGE_UPDATE_INFO *info = (LIBRARY_IMAGE_UPDATE_INFO *)pUpdate->pData;
+               msg.setCode(CMD_IMAGE_LIBRARY_UPDATE);
+               msg.setField(VID_GUID, info->guid);
+               msg.setField(VID_FLAGS, (UINT32)(info->removed ? 1 : 0));
+               sendMessage(&msg);
+               msg.deleteAllFields();
+               delete info;
             }
             break;
          default:
@@ -6895,7 +6889,7 @@ void ClientSession::InstallPackage(NXCPMessage *pRequest)
                   _tcscat(fullFileName, FS_PATH_SEPARATOR);
                   _tcscat(fullFileName, pszCleanFileName);
 
-                  DownloadFileInfo *fInfo = new DownloadFileInfo(fullFileName, CMD_INSTALL_PACKAGE);
+                  ServerDownloadFileInfo *fInfo = new ServerDownloadFileInfo(fullFileName, CMD_INSTALL_PACKAGE);
 
                   if (fInfo->open())
                   {
@@ -12160,20 +12154,18 @@ void ClientSession::sendLibraryImage(NXCPMessage *request)
                sendFile(absFileName, request->getId(), 0);
 }
 
-void ClientSession::onLibraryImageChange(uuid_t *guid, bool removed)
+/**
+ * Handle image library change
+ */
+void ClientSession::onLibraryImageChange(const uuid& guid, bool removed)
 {
-  UPDATE_INFO *pUpdate;
+  if (guid.isNull() || !isAuthenticated())
+     return;
 
-  if (guid != NULL && isAuthenticated())
-  {
-    pUpdate = (UPDATE_INFO *)malloc(sizeof(UPDATE_INFO));
-    pUpdate->dwCategory = INFO_CAT_LIBRARY_IMAGE;
-    LIBRARY_IMAGE_UPDATE_INFO *info = (LIBRARY_IMAGE_UPDATE_INFO *)malloc(sizeof(LIBRARY_IMAGE_UPDATE_INFO));
-    info->guid = (uuid_t *)(nx_memdup(guid, UUID_LENGTH));
-    info->removed = removed;
-    pUpdate->pData = info;
-    m_pUpdateQueue->put(pUpdate);
-  }
+   UPDATE_INFO *pUpdate = (UPDATE_INFO *)malloc(sizeof(UPDATE_INFO));
+   pUpdate->dwCategory = INFO_CAT_LIBRARY_IMAGE;
+   pUpdate->pData = new LIBRARY_IMAGE_UPDATE_INFO(guid, removed);
+   m_pUpdateQueue->put(pUpdate);
 }
 
 /**
@@ -12283,10 +12275,10 @@ void ClientSession::updateLibraryImage(NXCPMessage *request)
                                        _sntprintf(absFileName, MAX_PATH, _T("%s%s%s%s"), g_netxmsdDataDir, DDIR_IMAGES, FS_PATH_SEPARATOR, guidText);
                                        DbgPrintf(5, _T("updateLibraryImage: guid=%s, absFileName=%s"), guidText, absFileName);
 
-               DownloadFileInfo *dInfo = new DownloadFileInfo(absFileName, CMD_MODIFY_IMAGE);
+               ServerDownloadFileInfo *dInfo = new ServerDownloadFileInfo(absFileName, CMD_MODIFY_IMAGE);
                if (dInfo->open())
                {
-                  dInfo->setGUID(guid);
+                  dInfo->setImageGuid(guid);
                   m_downloadFileMap->set(request->getId(), dInfo);
                }
                else
@@ -12330,7 +12322,6 @@ void ClientSession::deleteLibraryImage(NXCPMessage *request)
 {
        NXCPMessage msg;
        UINT32 rcc = RCC_SUCCESS;
-       uuid_t guid;
        TCHAR guidText[64];
        TCHAR query[MAX_DB_STRING];
 
@@ -12344,8 +12335,8 @@ void ClientSession::deleteLibraryImage(NXCPMessage *request)
       return;
    }
 
-       request->getFieldAsBinary(VID_GUID, guid, UUID_LENGTH);
-       _uuid_to_string(guid, guidText);
+       uuid guid = request->getFieldAsGUID(VID_GUID);
+       guid.toString(guidText);
        debugPrintf(5, _T("deleteLibraryImage: guid=%s"), guidText);
 
    DB_HANDLE hdb = DBConnectionPoolAcquireConnection();
@@ -12394,7 +12385,7 @@ void ClientSession::deleteLibraryImage(NXCPMessage *request)
 
        if (rcc == RCC_SUCCESS)
        {
-               EnumerateClientSessions(ImageLibraryDeleteCallback, (void *)&guid);
+               EnumerateClientSessions(ImageLibraryDeleteCallback, &guid);
        }
 }
 
@@ -12867,7 +12858,7 @@ void ClientSession::receiveFile(NXCPMessage *request)
       _tcscat(fullPath, FS_PATH_SEPARATOR);
       _tcscat(fullPath, cleanFileName);
 
-      DownloadFileInfo *fInfo = new DownloadFileInfo(fullPath, CMD_UPLOAD_FILE, request->getFieldAsTime(VID_MODIFICATION_TIME));
+      ServerDownloadFileInfo *fInfo = new ServerDownloadFileInfo(fullPath, CMD_UPLOAD_FILE, request->getFieldAsTime(VID_MODIFICATION_TIME));
 
       if (fInfo->open())
       {
index 608b9dc..91dedf9 100644 (file)
@@ -396,25 +396,22 @@ public:
 /**
  * Class that stores information about file that will be received
  */
-class DownloadFileInfo
+class ServerDownloadFileInfo : public DownloadFileInfo
 {
-private:
-   TCHAR *m_fileName;
-   time_t m_lastModTime;
-   int m_file;
+protected:
    UINT32 m_uploadCommand;
    UINT32 m_uploadData;
-   uuid_t m_uploadImageGuid;
+   uuid m_uploadImageGuid;
 
 public:
-   DownloadFileInfo(const TCHAR *name, UINT32 uploadCommand, time_t lastModTime = 0);
-   ~DownloadFileInfo();
-   bool open();
-   void setUploadData(UINT32 data);
-   void setGUID(uuid_t guid);
+   ServerDownloadFileInfo(const TCHAR *name, UINT32 uploadCommand, time_t lastModTime = 0);
+   virtual ~ServerDownloadFileInfo();
+
+   virtual void close(bool success);
+
+   void setUploadData(UINT32 data) { m_uploadData = data; }
+   void setImageGuid(const uuid& guid) { m_uploadImageGuid = guid; }
    void updateAgentPkgDBInfo(const TCHAR *description, const TCHAR *pkgName, const TCHAR *pkgVersion, const TCHAR *platform, const TCHAR *cleanFileName);
-   bool write(const BYTE *data, int dataSize);
-   void close(bool success);
 };
 
 /**
@@ -461,7 +458,7 @@ private:
    UINT32 m_dwNumRecordsToUpload; // Number of records to be uploaded
    UINT32 m_dwRecordsUploaded;
    EPRule **m_ppEPPRuleList;   // List of loaded EPP rules
-   HashMap<UINT32, DownloadFileInfo> *m_downloadFileMap;
+   HashMap<UINT32, ServerDownloadFileInfo> *m_downloadFileMap;
    VolatileCounter m_refCount;
    UINT32 m_dwEncryptionRqId;
    UINT32 m_dwEncryptionResult;
@@ -827,7 +824,7 @@ public:
    void onObjectChange(NetObj *pObject);
    void onAlarmUpdate(UINT32 dwCode, const Alarm *alarm);
    void onActionDBUpdate(UINT32 dwCode, NXC_ACTION *pAction);
-   void onLibraryImageChange(uuid_t *guid, bool removed = false);
+   void onLibraryImageChange(const uuid& guid, bool removed = false);
 };
 
 /**