Agent deployment from console seems to be working
authorVictor Kirhenshtein <victor@netxms.org>
Wed, 16 Feb 2005 00:08:43 +0000 (00:08 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Wed, 16 Feb 2005 00:08:43 +0000 (00:08 +0000)
14 files changed:
include/nxclapi.h
src/console/win32/DeploymentView.cpp
src/console/win32/DeploymentView.h
src/console/win32/MainFrm.cpp
src/console/win32/MainFrm.h
src/console/win32/ObjectPreview.cpp
src/console/win32/ToolBox.cpp
src/console/win32/globals.cpp
src/console/win32/globals.h
src/console/win32/nxcon.clw
src/console/win32/nxcon.cpp
src/console/win32/resource.h
src/server/core/node.cpp
src/server/core/package.cpp

index c6d970d..efe8a13 100644 (file)
@@ -429,6 +429,7 @@ typedef void * NXC_SESSION;
 #define DEPLOYMENT_STATUS_INSTALLATION 2
 #define DEPLOYMENT_STATUS_COMPLETED    3
 #define DEPLOYMENT_STATUS_FAILED       4
+#define DEPLOYMENT_STATUS_INITIALIZE   5
 #define DEPLOYMENT_STATUS_FINISHED     255
 
 
index 71fb914..4ede229 100644 (file)
 static char THIS_FILE[] = __FILE__;
 #endif
 
+
+//
+// Constants
+//
+
+#define STATUS_HEIGHT         34
+#define PROGRESS_CTRL_TOP     20
+#define PROGRESS_CTRL_HEIGHT  9
+
+
 /////////////////////////////////////////////////////////////////////////////
 // CDeploymentView
 
@@ -18,6 +28,8 @@ IMPLEMENT_DYNCREATE(CDeploymentView, CMDIChildWnd)
 
 CDeploymentView::CDeploymentView()
 {
+   m_dwRqId = 0;
+   m_bFinished = FALSE;
 }
 
 CDeploymentView::~CDeploymentView()
@@ -28,8 +40,12 @@ CDeploymentView::~CDeploymentView()
 BEGIN_MESSAGE_MAP(CDeploymentView, CMDIChildWnd)
        //{{AFX_MSG_MAP(CDeploymentView)
        ON_WM_CREATE()
+       ON_WM_PAINT()
+       ON_WM_SIZE()
        //}}AFX_MSG_MAP
    ON_MESSAGE(WM_START_DEPLOYMENT, OnStartDeployment)
+   ON_MESSAGE(WM_DEPLOYMENT_INFO, OnDeploymentInfo)
+   ON_MESSAGE(WM_DEPLOYMENT_FINISHED, OnDeploymentFinished)
 END_MESSAGE_MAP()
 
 /////////////////////////////////////////////////////////////////////////////
@@ -54,14 +70,28 @@ int CDeploymentView::OnCreate(LPCREATESTRUCT lpCreateStruct)
        if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
                return -1;
 
+   // Create font
+   m_font.CreateFont(-MulDiv(8, GetDeviceCaps(GetDC()->m_hDC, LOGPIXELSY), 72),
+                     0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET,
+                     OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY,
+                     VARIABLE_PITCH | FF_DONTCARE, "Verdana");
+
+   // Create progress bar
+   GetClientRect(&rect);
+   rect.left += 4;
+   rect.right -= 4;
+   rect.top = PROGRESS_CTRL_TOP;
+   rect.bottom = rect.top + PROGRESS_CTRL_HEIGHT;
+   m_wndProgressCtrl.Create(WS_CHILD | WS_VISIBLE, rect, this, ID_PROGRESS_CTRL);
+
    // Create list view inside window
    GetClientRect(&rect);
-   rect.top += 20;
+   rect.top += STATUS_HEIGHT + 1;
    m_wndListCtrl.Create(WS_CHILD | WS_VISIBLE | LVS_REPORT, rect, this, ID_LIST_VIEW);
    m_wndListCtrl.InsertColumn(0, _T("Node"), LVCFMT_LEFT, 120);
    m_wndListCtrl.InsertColumn(1, _T("Status"), LVCFMT_LEFT, 100);
    m_wndListCtrl.InsertColumn(2, _T("Message"), LVCFMT_LEFT, 250);
-   m_wndListCtrl.SetExtendedStyle(LVS_EX_GRIDLINES);
+   m_wndListCtrl.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
        
        return 0;
 }
@@ -71,13 +101,16 @@ int CDeploymentView::OnCreate(LPCREATESTRUCT lpCreateStruct)
 // Deployment worker thread
 //
 
-static void DeploymentThread(DEPLOYMENT_JOB *pJob)
+static DWORD WINAPI DeploymentThread(DEPLOYMENT_JOB *pJob)
 {
    DWORD dwResult;
 
-   dwResult = NXCDeployPackage(g_hSession, pJob->dwPkgId, pJob->dwNumObjects, pJob->pdwObjectList);
+   dwResult = NXCDeployPackage(g_hSession, pJob->dwPkgId, pJob->dwNumObjects,
+                               pJob->pdwObjectList, pJob->pdwRqId);
+   PostMessage(pJob->hWnd, WM_DEPLOYMENT_FINISHED, 0, dwResult);
    safe_free(pJob->pdwObjectList);
    free(pJob);
+   return 0;
 }
 
 
@@ -87,6 +120,111 @@ static void DeploymentThread(DEPLOYMENT_JOB *pJob)
 
 void CDeploymentView::OnStartDeployment(WPARAM wParam, DEPLOYMENT_JOB *pJob)
 {
+   DWORD dwThreadId;
+   HANDLE hThread;
+
+   m_wndProgressCtrl.SetRange32(0, pJob->dwNumObjects);
+   m_wndProgressCtrl.SetStep(1);
+   m_wndProgressCtrl.SetPos(0);
+
    pJob->hWnd = m_hWnd;
-   CreateThread(NULL, 0, DeploymentThread, pJob, 0, &dwThreadId);
+   pJob->pdwRqId = &m_dwRqId;
+   hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)DeploymentThread,
+                          pJob, 0, &dwThreadId);
+   if (hThread != NULL)
+   {
+      CloseHandle(hThread);
+   }
+}
+
+
+//
+// WM_DEPLOYMENT_INFO message handler
+//
+
+void CDeploymentView::OnDeploymentInfo(DWORD dwRqId, NXC_DEPLOYMENT_STATUS *pInfo)
+{
+   if (dwRqId == m_dwRqId)
+   {
+      LVFINDINFO lvfi;
+      int iItem;
+
+      // Find node's record
+      lvfi.flags = LVFI_PARAM;
+      lvfi.lParam = pInfo->dwNodeId;
+      iItem = m_wndListCtrl.FindItem(&lvfi, -1);
+      if (iItem == -1)
+      {
+         NXC_OBJECT *pObject;
+
+         // Create new record
+         pObject = NXCFindObjectById(g_hSession, pInfo->dwNodeId);
+         iItem = m_wndListCtrl.InsertItem(0x7FFFFFFF, (pObject != NULL) ? pObject->szName : _T("<invalid>"));
+         m_wndListCtrl.SetItemData(iItem, pInfo->dwNodeId);
+         m_wndProgressCtrl.SetRange32(0, m_wndListCtrl.GetItemCount());
+      }
+      m_wndListCtrl.SetItemText(iItem, 1, g_szDeploymentStatus[pInfo->dwStatus]);
+      m_wndListCtrl.SetItemText(iItem, 2, 
+         (pInfo->dwStatus == DEPLOYMENT_STATUS_FAILED) ? pInfo->pszErrorMessage : _T(""));
+
+      if ((pInfo->dwStatus == DEPLOYMENT_STATUS_FAILED) ||
+          (pInfo->dwStatus == DEPLOYMENT_STATUS_COMPLETED))
+         m_wndProgressCtrl.StepIt();
+   }
+}
+
+
+//
+// WM_PAINT message handler
+//
+
+void CDeploymentView::OnPaint() 
+{
+       CPaintDC dc(this); // device context for painting
+   RECT rect;
+   CPen pen, *pOldPen;
+   CFont *pOldFont;
+
+   // Draw separator between status box and node list
+   pen.CreatePen(PS_SOLID, 0, RGB(127, 127, 127));
+   pOldPen = dc.SelectObject(&pen);
+
+   GetClientRect(&rect);
+   dc.MoveTo(0, STATUS_HEIGHT);
+   dc.LineTo(rect.right, STATUS_HEIGHT);
+
+   dc.SelectObject(pOldPen);
+
+   // Show current status
+   pOldFont = dc.SelectObject(&m_font);
+   dc.TextOut(4, 4, m_bFinished ? _T("Job finished") : _T("Job running "), 12);
+   dc.SelectObject(pOldFont);
+}
+
+
+//
+// WM_SIZE messahe handler
+//
+
+void CDeploymentView::OnSize(UINT nType, int cx, int cy) 
+{
+       CMDIChildWnd::OnSize(nType, cx, cy);
+
+   m_wndProgressCtrl.SetWindowPos(NULL, 4, PROGRESS_CTRL_TOP, cx - 8, PROGRESS_CTRL_HEIGHT, SWP_NOZORDER);
+   m_wndListCtrl.SetWindowPos(NULL, 0, STATUS_HEIGHT + 1, cx, cy - STATUS_HEIGHT, SWP_NOZORDER);
+}
+
+
+//
+// WM_DEPLOYMENT_FINISHED message handler
+//
+
+void CDeploymentView::OnDeploymentFinished(WPARAM wParam, LPARAM lParam)
+{
+   m_bFinished = TRUE;
+   InvalidateRect(NULL);
+   if (lParam == RCC_SUCCESS)
+      MessageBox(_T("Deployment job finished successfully"), _T("Information"), MB_OK | MB_ICONINFORMATION);
+   else
+      theApp.ErrorBox(lParam, _T("Deployment job failed: %s"));
 }
index 42df7fe..fc35158 100644 (file)
@@ -31,14 +31,22 @@ public:
 
 // Implementation
 protected:
+       CProgressCtrl m_wndProgressCtrl;
+       CFont m_font;
+   BOOL m_bFinished;
+       DWORD m_dwRqId;
        CListCtrl m_wndListCtrl;
        virtual ~CDeploymentView();
 
        // Generated message map functions
        //{{AFX_MSG(CDeploymentView)
        afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+       afx_msg void OnPaint();
+       afx_msg void OnSize(UINT nType, int cx, int cy);
        //}}AFX_MSG
    afx_msg void OnStartDeployment(WPARAM wParam, DEPLOYMENT_JOB *pJob);
+   afx_msg void OnDeploymentInfo(DWORD dwRqId, NXC_DEPLOYMENT_STATUS *pInfo);
+   afx_msg void OnDeploymentFinished(WPARAM wParam, LPARAM lParam);
        DECLARE_MESSAGE_MAP()
 };
 
index 8eab995..7714a50 100644 (file)
@@ -29,6 +29,7 @@ BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
    ON_MESSAGE(WM_USERDB_CHANGE, OnUserDBChange)
    ON_MESSAGE(WM_STATE_CHANGE, OnStateChange)
    ON_MESSAGE(WM_ALARM_UPDATE, OnAlarmUpdate)
+   ON_MESSAGE(WM_DEPLOYMENT_INFO, OnDeploymentInfo)
 END_MESSAGE_MAP()
 
 static UINT indicators[] =
@@ -176,6 +177,18 @@ void CMainFrame::OnUserDBChange(WPARAM wParam, LPARAM lParam)
 }
 
 
+//
+// Handler for WM_DEPLOYMENT_INFO message
+//
+
+void CMainFrame::OnDeploymentInfo(WPARAM wParam, LPARAM lParam)
+{
+   BroadcastMessage(WM_DEPLOYMENT_INFO, wParam, lParam, FALSE);
+   safe_free(((NXC_DEPLOYMENT_STATUS *)lParam)->pszErrorMessage)
+   free((void *)lParam);
+}
+
+
 //
 // WM_COMMAND::ID_UPDATE_EVENT_LIST message handler
 //
index 6c9eb76..0e87b84 100644 (file)
@@ -56,6 +56,7 @@ protected:
    afx_msg void OnObjectChange(WPARAM wParam, LPARAM lParam);
    afx_msg void OnUserDBChange(WPARAM wParam, LPARAM lParam);
    afx_msg void OnAlarmUpdate(WPARAM wParam, LPARAM lParam);
+   afx_msg void OnDeploymentInfo(WPARAM wParam, LPARAM lParam);
        DECLARE_MESSAGE_MAP()
 };
 
index 60823bc..032b45b 100644 (file)
@@ -12,14 +12,6 @@ static char THIS_FILE[] = __FILE__;
 #endif
 
 
-//
-// Constants
-//
-
-#define TOOLBOX_X_MARGIN   5
-#define TOOLBOX_Y_MARGIN   5
-
-
 /////////////////////////////////////////////////////////////////////////////
 // CObjectPreview
 
@@ -100,17 +92,16 @@ void CObjectPreview::OnPaint()
 {
    CPaintDC dc(this); // device context for painting
    RECT rect;
-   CPen pen;
+   CPen pen, *pOldPen;
 
    pen.CreatePen(PS_SOLID, 0, RGB(127, 127, 127));
-   dc.SelectObject(&pen);
+   pOldPen = dc.SelectObject(&pen);
 
    GetClientRect(&rect);
-   
    dc.MoveTo(rect.right - 1, 0);
    dc.LineTo(rect.right - 1, rect.bottom);
 
-   pen.DeleteObject();
+   dc.SelectObject(pOldPen);
 }
 
 
index 9c8fe4a..d978465 100644 (file)
@@ -55,7 +55,7 @@ BOOL CToolBox::PreCreateWindow(CREATESTRUCT& cs)
        return CWnd::PreCreateWindow(cs);
 }
 
-BOOL CToolBox::Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) 
+BOOL CToolBox::Create(LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
 {
    strncpy(m_szTitle, lpszWindowName, MAX_TOOLBOX_TITLE - 1);
        return CWnd::Create(NULL, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
index 87cb028..5751f1a 100644 (file)
@@ -83,12 +83,15 @@ TCHAR *g_szStatusText[] = { "NORMAL", "WARNING", "MINOR", "MAJOR",
 TCHAR *g_szStatusTextSmall[] = { "Normal", "Warning", "Minor", "Major",
                                  "Critical", "Unknown", "Unmanaged",
                                  "Disabled", "Testing" };
-TCHAR *g_szObjectClass[] = { "Generic", "Subnet", "Node", "Interface", "Network"
-                             "Container", "Zone", "ServiceRoot", "Template"
-                             "TemplateGroup", "TemplateRoot", "NetworkService" };
+TCHAR *g_szObjectClass[] = { _T("Generic"), _T("Subnet"), _T("Node"), _T("Interface"), _T("Network")
+                             _T("Container"), _T("Zone"), _T("ServiceRoot"), _T("Template")
+                             _T("TemplateGroup"), _T("TemplateRoot"), _T("NetworkService") };
 TCHAR *g_szActionType[] = { _T("Execute"), _T("Remote"), _T("E-Mail"), _T("SMS") };
 TCHAR *g_szServiceType[] = { _T("User-defined"), _T("SSH"), _T("POP3"), _T("SMTP"),
                              _T("FTP"), _T("HTTP"), NULL };
+TCHAR *g_szDeploymentStatus[] = { _T("Pending"), _T("Uploading package"),
+                                  _T("Installing"), _T("Completed"), _T("Failed"),
+                                  _T("Initializing") };
 TCHAR *g_szInterfaceTypes[] = 
 {
    "Unknown",
index e9b3d3b..2d7e342 100644 (file)
@@ -42,6 +42,9 @@ extern CConsoleApp theApp;
 #define MAX_PASSWORD_LEN      64
 #define MAX_INTERFACE_TYPE    32
 
+#define TOOLBOX_X_MARGIN      5
+#define TOOLBOX_Y_MARGIN      5
+
 
 //
 // User interface options
@@ -74,6 +77,7 @@ extern CConsoleApp theApp;
 #define WM_POLLER_MESSAGE        (WM_USER + 10)
 #define WM_START_DEPLOYMENT      (WM_USER + 11)
 #define WM_DEPLOYMENT_INFO       (WM_USER + 12)
+#define WM_DEPLOYMENT_FINISHED   (WM_USER + 13)
 
 
 //
@@ -144,6 +148,7 @@ struct DEPLOYMENT_JOB
    DWORD dwNumObjects;
    DWORD *pdwObjectList;
    HWND hWnd;
+   DWORD *pdwRqId;
 };
 
 
@@ -229,6 +234,7 @@ extern TCHAR *g_szStatusText[];
 extern TCHAR *g_szStatusTextSmall[];
 extern TCHAR *g_szActionType[];
 extern TCHAR *g_szServiceType[];
+extern TCHAR *g_szDeploymentStatus[];
 extern COLORREF g_statusColorTable[];
 extern char *g_szObjectClass[];
 extern char *g_szInterfaceTypes[];
index def4be6..9d31da8 100644 (file)
@@ -16,9 +16,9 @@ Class7=CEventBrowser
 Class9=CMapView
 
 ResourceCount=113
-Resource1=IDD_USER_PROPERTIES (English (U.S.))
+Resource1=IDD_LOGIN (English (U.S.))
 Resource2=IDD_OBJECT_NODE_GENERAL
-Resource3=IDD_CREATE_TG (English (U.S.))
+Resource3=IDD_EDIT_RULE_SEVERITY (English (U.S.))
 Resource4=IDD_SELECT_OBJECT
 Resource5=IDD_SELECT_ACTION
 Class2=CChildView
@@ -32,9 +32,9 @@ Resource7=IDD_NEW_USER
 Class12=CObjectBrowser
 Resource8=IDD_CREATE_CONTAINER
 Class13=CObjectPropDlg
-Resource9=IDD_EDIT_RULE_COMMENT (English (U.S.))
-Resource10=IDD_EDIT_TRAP_ARG (English (U.S.))
-Resource11=IDA_EVENT_EDITOR (English (U.S.))
+Resource9=IDD_NEW_USER (English (U.S.))
+Resource10=IDD_ACTION_PROPERTIES (English (U.S.))
+Resource11=IDD_INPUT_BOX (English (U.S.))
 Resource12=IDR_CTRLPANEL (English (U.S.))
 Resource13=IDR_EVENTS (English (U.S.))
 Resource14=IDR_MAPFRAME (English (U.S.))
@@ -42,33 +42,33 @@ Resource15=IDR_OBJECTS (English (U.S.))
 Resource16=IDD_DUMMY (English (U.S.))
 Class14=CEventEditor
 Class15=CEditEventDlg
-Resource17=IDD_EDIT_EVENT (English (U.S.))
+Resource17=IDA_ALARM_BROWSER (English (U.S.))
 Class16=CDebugFrame
-Resource18=IDA_OBJECT_BROWSER (English (U.S.))
+Resource18=IDD_EDIT_TRAP_ARG (English (U.S.))
 Resource19=IDD_OBJECT_PROPERTIES (English (U.S.))
 Resource20=IDD_SELECT_EVENT
 Class17=CObjectPreview
-Resource21=IDD_ACTION_PROPERTIES (English (U.S.))
+Resource21=IDD_MIB_BROWSER (English (U.S.))
 Class18=CToolBox
 Class19=CObjectInfoBox
 Class20=CObjectSearchBox
-Resource22=IDD_THRESHOLD (English (U.S.))
+Resource22=IDD_OBJECT_GENERAL (English (U.S.))
 Class21=CEditBox
 Class22=COPGeneral
 Class23=CNodePropsGeneral
-Resource23=IDA_ALARM_BROWSER (English (U.S.))
+Resource23=IDD_SELECT_INTERNAL_ITEM (English (U.S.))
 Class24=CObjectPropCaps
 Class25=CObjectPropSheet
 Resource24=IDA_MDI_DEFAULT
 Class26=CRequestProcessingDlg
-Resource25=IDA_NETMAP (English (U.S.))
+Resource25=IDD_SELECT_AGENT_PARAM (English (U.S.))
 Resource26=IDD_PROGRESS (English (U.S.))
 Resource27=IDD_EDIT_RULE_ALARM
-Resource28=IDR_MAINFRAME (English (U.S.))
+Resource28=IDD_DATA_QUERY (English (U.S.))
 Class27=CObjectPropsGeneral
-Resource29=IDD_SELECT_INTERNAL_ITEM (English (U.S.))
+Resource29=IDD_CREATE_CONTAINER (English (U.S.))
 Class28=CObjectPropsSecurity
-Resource30=IDD_CP_GENERAL (English (U.S.))
+Resource30=IDD_DCI_THRESHOLDS (English (U.S.))
 Resource31=IDD_SELECT_USER
 Resource32=IDD_OBJECT_SECURITY
 Class29=CUserSelectDlg
@@ -79,36 +79,36 @@ Class31=CNewUserDlg
 Resource35=IDD_THRESHOLD
 Resource36=IDA_EPP
 Class32=CUserPropDlg
-Resource37=IDD_CREATE_TEMPLATE (English (U.S.))
+Resource37=IDD_EDIT_RULE_ALARM (English (U.S.))
 Resource38=IDD_ABOUTBOX
 Class33=CGroupPropDlg
 Resource39=IDD_CP_GENERAL
 Resource40=IDA_TRAP_EDITOR
 Resource41=IDM_VIEW_SPECIFIC
-Resource42=IDD_OBJECT_NODE_GENERAL (English (U.S.))
+Resource42=IDA_NETMAP (English (U.S.))
 Class34=CPasswordChangeDlg
 Class35=CNodeSummary
 Class36=CNetSummaryFrame
 Class37=CDataCollectionEditor
-Resource43=IDD_EDIT_RULE_SEVERITY (English (U.S.))
+Resource43=IDD_SET_PASSWORD (English (U.S.))
 Class38=CDCIPropPage
-Resource44=IDD_LOGIN (English (U.S.))
+Resource44=IDA_EPP (English (U.S.))
 Class39=CDCIDataView
-Resource45=IDD_CREATE_NODE (English (U.S.))
+Resource45=IDD_SELECT_EVENT (English (U.S.))
 Class40=CGraph
 Class41=CGraphFrame
 Class42=CDCIThresholdsPage
-Resource46=IDD_SELECT_EVENT (English (U.S.))
-Resource47=IDA_GRAPH (English (U.S.))
+Resource46=IDD_USER_PROPERTIES (English (U.S.))
+Resource47=IDR_MAINFRAME (English (U.S.))
 Resource48=IDM_CONTEXT
 Class43=CThresholdDlg
-Resource49=IDD_OBJECT_CAPS (English (U.S.))
+Resource49=IDA_EVENT_EDITOR (English (U.S.))
 Resource50=IDD_EDIT_TRAP_ARG
 Class44=CMIBBrowserDlg
 Class45=CEventPolicyEditor
 Class46=CRuleList
 Class47=CRuleHeader
-Resource51=IDD_DATA_QUERY (English (U.S.))
+Resource51=IDD_CP_GENERAL (English (U.S.))
 Resource52=IDD_CREATE_NODE
 Class48=CObjectSelDlg
 Resource53=IDD_OBJECT_CAPS
@@ -117,22 +117,22 @@ Class49=CRuleCommentDlg
 Resource55=IDD_DCI_COLLECTION
 Class50=CEventSelDlg
 Resource56=IDD_DATA_QUERY
-Resource57=IDA_PACKAGE_MGR (English (U.S.))
+Resource57=IDA_MDI_DEFAULT (English (U.S.))
 Resource58=IDD_CREATE_TG
-Resource59=IDD_REQUEST_PROCESSING (English (U.S.))
-Resource60=IDD_SET_PASSWORD (English (U.S.))
+Resource59=IDA_ACTION_EDITOR (English (U.S.))
+Resource60=IDD_OBJECT_NODE_GENERAL (English (U.S.))
 Class51=CObjectPropsPresentation
-Resource61=IDD_DCI_THRESHOLDS (English (U.S.))
+Resource61=IDD_REQUEST_PROCESSING (English (U.S.))
 Resource62=IDD_EDIT_RULE_COMMENT
 Class52=CRuleSeverityDlg
 Resource63=IDD_ACTION_PROPERTIES
 Class53=CRuleAlarmDlg
 Class54=CAlarmBrowser
-Resource64=IDA_MDI_DEFAULT (English (U.S.))
+Resource64=IDD_EDIT_TRAP (English (U.S.))
 Resource65=IDD_DCI_TRANSFORM
-Resource66=IDD_EDIT_TRAP (English (U.S.))
-Resource67=IDD_GROUP_PROPERTIES (English (U.S.))
-Resource68=IDD_OBJECT_SECURITY (English (U.S.))
+Resource66=IDD_NEW_ACTION (English (U.S.))
+Resource67=IDD_EDIT_EVENT (English (U.S.))
+Resource68=IDA_GRAPH (English (U.S.))
 Class55=CConsolePropsGeneral
 Class56=CActionEditor
 Resource69=IDA_ACTION_EDITOR
@@ -143,18 +143,18 @@ Class58=CEditActionDlg
 Resource72=IDA_NETMAP
 Class59=CActionSelDlg
 Resource73=IDD_MIB_BROWSER
-Resource74=IDD_SELECT_USER (English (U.S.))
-Resource75=IDD_SELECT_OBJECT (English (U.S.))
+Resource74=IDA_PACKAGE_MGR (English (U.S.))
+Resource75=IDD_SELECT_USER (English (U.S.))
 Resource76=IDD_USER_PROPERTIES
 Class60=CCreateObjectDlg
 Class61=CCreateContainerDlg
 Resource77=IDR_MAINFRAME
 Class62=CCreateNodeDlg
-Resource78=IDD_GRAPH_PROPERTIES (English (U.S.))
-Resource79=IDD_EDIT_RULE_ALARM (English (U.S.))
-Resource80=IDD_ABOUTBOX (English (U.S.))
+Resource78=IDD_SELECT_ACTION (English (U.S.))
+Resource79=IDD_DCI_COLLECTION (English (U.S.))
+Resource80=IDA_OBJECT_BROWSER (English (U.S.))
 Class63=CDCITransformPage
-Resource81=IDD_OBJECT_PRESENTATION (English (U.S.))
+Resource81=IDD_GROUP_PROPERTIES (English (U.S.))
 Class64=CPollNodeDlg
 Resource82=IDD_POLL_NODE (English (U.S.))
 Class65=CNodePoller
@@ -180,28 +180,28 @@ Class73=CColorSelector
 Class74=CPackageMgr
 Resource94=IDD_GROUP_PROPERTIES
 Resource95=IDD_GRAPH_PROPERTIES
-Resource96=IDD_SELECT_AGENT_PARAM (English (U.S.))
-Resource97=IDD_INPUT_BOX (English (U.S.))
-Resource98=IDD_CREATE_NETSRV (English (U.S.))
-Resource99=IDD_OBJECT_NETSRV_GENERAL (English (U.S.))
-Resource100=IDD_OBJECT_GENERAL (English (U.S.))
-Resource101=IDD_NEW_USER (English (U.S.))
-Resource102=IDD_SELECT_ACTION (English (U.S.))
-Resource103=IDD_CREATE_CONTAINER (English (U.S.))
-Resource104=IDD_DCI_TRANSFORM (English (U.S.))
-Resource105=IDM_CONTEXT (English (U.S.))
-Resource106=IDM_VIEW_SPECIFIC (English (U.S.))
-Resource107=IDA_TRAP_EDITOR (English (U.S.))
+Resource96=IDD_CREATE_NODE (English (U.S.))
+Resource97=IDD_DCI_TRANSFORM (English (U.S.))
+Resource98=IDD_CREATE_TG (English (U.S.))
+Resource99=IDD_CREATE_TEMPLATE (English (U.S.))
+Resource100=IDA_TRAP_EDITOR (English (U.S.))
+Resource101=IDD_ABOUTBOX (English (U.S.))
+Resource102=IDD_SELECT_OBJECT (English (U.S.))
+Resource103=IDD_EDIT_RULE_COMMENT (English (U.S.))
+Resource104=IDD_OBJECT_PRESENTATION (English (U.S.))
+Resource105=IDM_VIEW_SPECIFIC (English (U.S.))
+Resource106=IDM_CONTEXT (English (U.S.))
+Resource107=IDD_OBJECT_NETSRV_GENERAL (English (U.S.))
 Class75=CInternalItemSelDlg
-Resource108=IDD_DCI_COLLECTION (English (U.S.))
+Resource108=IDD_OBJECT_CAPS (English (U.S.))
 Class76=CAgentParamSelDlg
-Resource109=IDA_ACTION_EDITOR (English (U.S.))
+Resource109=IDD_CREATE_NETSRV (English (U.S.))
 Class77=CInputBox
-Resource110=IDD_NEW_ACTION (English (U.S.))
+Resource110=IDD_THRESHOLD (English (U.S.))
 Class78=CCreateNetSrvDlg
-Resource111=IDA_EPP (English (U.S.))
+Resource111=IDD_GRAPH_PROPERTIES (English (U.S.))
 Class79=CNetSrvPropsGeneral
-Resource112=IDD_MIB_BROWSER (English (U.S.))
+Resource112=IDD_OBJECT_SECURITY (English (U.S.))
 Class80=CNodePropsPolling
 Class81=CDeploymentView
 Resource113=IDD_OBJECT_NODE_POLL (English (U.S.))
index 0b7b180..3090fdb 100644 (file)
@@ -668,6 +668,7 @@ void CConsoleApp::OnViewObjectbrowser()
 void CConsoleApp::EventHandler(DWORD dwEvent, DWORD dwCode, void *pArg)
 {
        CMainFrame* pFrame = STATIC_DOWNCAST(CMainFrame, m_pMainWnd);
+   NXC_DEPLOYMENT_STATUS *pStatus;
 
    switch(dwEvent)
    {
@@ -682,12 +683,17 @@ void CConsoleApp::EventHandler(DWORD dwEvent, DWORD dwCode, void *pArg)
       case NXC_EVENT_USER_DB_CHANGED:
          ((CMainFrame *)m_pMainWnd)->PostMessage(WM_USERDB_CHANGE, dwCode, (LPARAM)pArg);
          break;
+      case NXC_EVENT_DEPLOYMENT_STATUS:
+         pStatus = (NXC_DEPLOYMENT_STATUS *)nx_memdup(pArg, sizeof(NXC_DEPLOYMENT_STATUS));
+         pStatus->pszErrorMessage = _tcsdup(pStatus->pszErrorMessage);
+         ((CMainFrame *)m_pMainWnd)->PostMessage(WM_DEPLOYMENT_INFO, dwCode, (LPARAM)pStatus);
+         break;
       case NXC_EVENT_NOTIFICATION:
          switch(dwCode)
          {
             case NX_NOTIFY_SHUTDOWN:
                m_pMainWnd->MessageBox("Server was shutdown", "Warning", MB_OK | MB_ICONSTOP);
-               PostQuitMessage(0);
+               m_pMainWnd->PostMessage(WM_CLOSE, 0, 0);
                break;
             case NX_NOTIFY_EVENTDB_CHANGED:
                m_pMainWnd->PostMessage(WM_COMMAND, ID_UPDATE_EVENT_LIST, 0);
index f0fde71..88789e1 100644 (file)
@@ -26,6 +26,7 @@
 #define ID_RULE_LIST                    114
 #define ID_HEADER_CTRL                  115
 #define ID_SIZEBOX                      118
+#define ID_PROGRESS_CTRL                120
 #define IDR_MAINFRAME                   128
 #define IDR_NXCONTYPE                   129
 #define IDI_ALARM                       130
 #define _APS_NEXT_RESOURCE_VALUE        258
 #define _APS_NEXT_COMMAND_VALUE         32915
 #define _APS_NEXT_CONTROL_VALUE         1235
-#define _APS_NEXT_SYMED_VALUE           120
+#define _APS_NEXT_SYMED_VALUE           121
 #endif
 #endif
index f7a547e..d5fc5ba 100644 (file)
@@ -1501,10 +1501,10 @@ AgentConnection *Node::CreateAgentConnection(void)
 {
    AgentConnection *pConn;
 
-   if (!(g_dwFlags & NF_IS_NATIVE_AGENT))
+   if (!(m_dwFlags & NF_IS_NATIVE_AGENT))
       return NULL;
 
-   pConn = new AgentConnection(m_dwIpAddr, m_wAgentPort, m_wAuthMethod, m_szSharedSecret);
+   pConn = new AgentConnection(htonl(m_dwIpAddr), m_wAgentPort, m_wAuthMethod, m_szSharedSecret);
    if (!pConn->Connect())
    {
       delete pConn;
index c323813..6926d1b 100644 (file)
@@ -164,6 +164,10 @@ static THREAD_RESULT THREAD_CALL DeploymentThread(void *pArg)
       // Preset node id in notification message
       msg.SetVariable(VID_OBJECT_ID, pNode->Id());
 
+      // Change deployment status to "Initializing"
+      msg.SetVariable(VID_DEPLOYMENT_STATUS, (WORD)DEPLOYMENT_STATUS_INITIALIZE);
+      pStartup->pSession->SendMessage(&msg);
+
       // Create agent connection
       pAgentConn = pNode->CreateAgentConnection();
       if (pAgentConn != NULL)