Was missing in CVS
authorVictor Kirhenshtein <victor@netxms.org>
Mon, 21 Feb 2005 18:57:44 +0000 (18:57 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Mon, 21 Feb 2005 18:57:44 +0000 (18:57 +0000)
.gitattributes
src/console/win32/NetSrvPropsGeneral.cpp [new file with mode: 0644]
src/console/win32/NetSrvPropsGeneral.h [new file with mode: 0644]

index 092a69b..b46c733 100644 (file)
@@ -354,6 +354,8 @@ src/console/win32/MapFrame.cpp -text
 src/console/win32/MapFrame.h -text
 src/console/win32/MapView.cpp -text
 src/console/win32/MapView.h -text
+src/console/win32/NetSrvPropsGeneral.cpp -text
+src/console/win32/NetSrvPropsGeneral.h -text
 src/console/win32/NetSummaryFrame.cpp -text
 src/console/win32/NetSummaryFrame.h -text
 src/console/win32/NewActionDlg.cpp -text
diff --git a/src/console/win32/NetSrvPropsGeneral.cpp b/src/console/win32/NetSrvPropsGeneral.cpp
new file mode 100644 (file)
index 0000000..afc4a8b
--- /dev/null
@@ -0,0 +1,368 @@
+// NetSrvPropsGeneral.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "nxcon.h"
+#include "NetSrvPropsGeneral.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CNetSrvPropsGeneral property page
+
+IMPLEMENT_DYNCREATE(CNetSrvPropsGeneral, CPropertyPage)
+
+CNetSrvPropsGeneral::CNetSrvPropsGeneral() : CPropertyPage(CNetSrvPropsGeneral::IDD)
+{
+       //{{AFX_DATA_INIT(CNetSrvPropsGeneral)
+       m_dwObjectId = 0;
+       m_strName = _T("");
+       m_iPort = 0;
+       m_strRequest = _T("");
+       m_strResponce = _T("");
+       m_iProto = 0;
+       //}}AFX_DATA_INIT
+}
+
+CNetSrvPropsGeneral::~CNetSrvPropsGeneral()
+{
+}
+
+void CNetSrvPropsGeneral::DoDataExchange(CDataExchange* pDX)
+{
+       CPropertyPage::DoDataExchange(pDX);
+       //{{AFX_DATA_MAP(CNetSrvPropsGeneral)
+       DDX_Control(pDX, IDC_COMBO_TYPE, m_wndTypeList);
+       DDX_Text(pDX, IDC_EDIT_ID, m_dwObjectId);
+       DDX_Text(pDX, IDC_EDIT_NAME, m_strName);
+       DDX_Text(pDX, IDC_EDIT_PORT, m_iPort);
+       DDV_MinMaxLong(pDX, m_iPort, 0, 65535);
+       DDX_Text(pDX, IDC_EDIT_REQUEST, m_strRequest);
+       DDX_Text(pDX, IDC_EDIT_RESPONCE, m_strResponce);
+       DDX_Text(pDX, IDC_EDIT_PROTO, m_iProto);
+       DDV_MinMaxLong(pDX, m_iProto, 0, 255);
+       //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CNetSrvPropsGeneral, CPropertyPage)
+       //{{AFX_MSG_MAP(CNetSrvPropsGeneral)
+       ON_EN_CHANGE(IDC_EDIT_NAME, OnChangeEditName)
+       ON_CBN_SELCHANGE(IDC_COMBO_TYPE, OnSelchangeComboType)
+       ON_EN_CHANGE(IDC_EDIT_REQUEST, OnChangeEditRequest)
+       ON_EN_CHANGE(IDC_EDIT_RESPONCE, OnChangeEditResponce)
+       ON_BN_CLICKED(IDC_RADIO_TCP, OnRadioTcp)
+       ON_BN_CLICKED(IDC_RADIO_UDP, OnRadioUdp)
+       ON_BN_CLICKED(IDC_RADIO_ICMP, OnRadioIcmp)
+       ON_BN_CLICKED(IDC_RADIO_OTHER, OnRadioOther)
+       ON_BN_CLICKED(IDC_SELECT_IP, OnSelectIp)
+       ON_BN_CLICKED(IDC_SELECT_POLLER, OnSelectPoller)
+       //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CNetSrvPropsGeneral message handlers
+
+
+//
+// WM_INITDIALOG message handler
+//
+
+BOOL CNetSrvPropsGeneral::OnInitDialog() 
+{
+   int i;
+
+       CPropertyPage::OnInitDialog();
+       
+   m_pUpdate = ((CObjectPropSheet *)GetParent())->GetUpdateStruct();
+
+   // Add service types to combo box
+   for(i = 0; g_szServiceType[i] != NULL; i++)
+      m_wndTypeList.AddString(g_szServiceType[i]);
+   m_wndTypeList.SelectString(-1, g_szServiceType[m_iServiceType]);
+
+   // Poller node
+   if (m_dwPollerNode != 0)
+   {
+      NXC_OBJECT *pNode;
+
+      pNode = NXCFindObjectById(g_hSession, m_dwPollerNode);
+      if (pNode != NULL)
+      {
+         SetDlgItemText(IDC_EDIT_POLLER, pNode->szName);
+      }
+      else
+      {
+         SetDlgItemText(IDC_EDIT_POLLER, _T("<invalid>"));
+      }
+   }
+   else
+   {
+      SetDlgItemText(IDC_EDIT_POLLER, _T("<default>"));
+   }
+
+   // Listen IP address
+   if (m_dwIpAddr != 0)
+   {
+      TCHAR szBuffer[16];
+
+      IpToStr(m_dwIpAddr, szBuffer);
+      SetDlgItemText(IDC_EDIT_IPADDR, szBuffer);
+   }
+   else
+   {
+      SetDlgItemText(IDC_EDIT_IPADDR, _T("<any>"));
+   }
+
+   SetProtocolCtrls();
+       
+       return TRUE;
+}
+
+
+//
+// Handler for OK button
+//
+
+void CNetSrvPropsGeneral::OnOK() 
+{
+       CPropertyPage::OnOK();
+
+   // Set fields in update structure
+   m_pUpdate->pszName = (char *)((LPCTSTR)m_strName);
+   m_pUpdate->pszRequest = (char *)((LPCTSTR)m_strRequest);
+   m_pUpdate->pszResponce = (char *)((LPCTSTR)m_strResponce);
+   m_pUpdate->iServiceType = m_iServiceType;
+   m_pUpdate->wPort = (WORD)m_iPort;
+   m_pUpdate->wProto = (WORD)m_iProto;
+   m_pUpdate->dwPollerNode = m_dwPollerNode;
+   m_pUpdate->dwIpAddr = m_dwIpAddr;
+}
+
+
+//
+// Handlers for changed controls
+//
+
+void CNetSrvPropsGeneral::OnChangeEditName() 
+{
+   m_pUpdate->dwFlags |= OBJ_UPDATE_NAME;
+   SetModified();
+}
+
+void CNetSrvPropsGeneral::OnChangeEditRequest() 
+{
+   m_pUpdate->dwFlags |= OBJ_UPDATE_CHECK_REQUEST;
+   SetModified();
+}
+
+void CNetSrvPropsGeneral::OnChangeEditResponce() 
+{
+   m_pUpdate->dwFlags |= OBJ_UPDATE_CHECK_RESPONCE;
+   SetModified();
+}
+
+void CNetSrvPropsGeneral::OnSelchangeComboType() 
+{
+   TCHAR szBuffer[256];
+
+   // Determine service type
+   m_wndTypeList.GetWindowText(szBuffer, 256);
+   for(m_iServiceType = 0; g_szServiceType[m_iServiceType] != NULL; m_iServiceType++)
+      if (!_tcscmp(szBuffer, g_szServiceType[m_iServiceType]))
+         break;
+   SetProtocolCtrls();
+
+   m_pUpdate->dwFlags |= OBJ_UPDATE_SERVICE_TYPE;
+   SetModified();
+}
+
+void CNetSrvPropsGeneral::OnRadioTcp() 
+{
+   SetDlgItemText(IDC_EDIT_PROTO, _T("6"));
+   EnableDlgItem(this, IDC_EDIT_PROTO, FALSE);
+   m_pUpdate->dwFlags |= OBJ_UPDATE_IP_PROTO;
+   SetModified();
+}
+
+void CNetSrvPropsGeneral::OnRadioUdp() 
+{
+   SetDlgItemText(IDC_EDIT_PROTO, _T("17"));
+   EnableDlgItem(this, IDC_EDIT_PROTO, FALSE);
+   m_pUpdate->dwFlags |= OBJ_UPDATE_IP_PROTO;
+   SetModified();
+}
+
+void CNetSrvPropsGeneral::OnRadioIcmp() 
+{
+   SetDlgItemText(IDC_EDIT_PROTO, _T("1"));
+   EnableDlgItem(this, IDC_EDIT_PROTO, FALSE);
+   m_pUpdate->dwFlags |= OBJ_UPDATE_IP_PROTO;
+   SetModified();
+}
+
+void CNetSrvPropsGeneral::OnRadioOther() 
+{
+   EnableDlgItem(this, IDC_EDIT_PROTO, TRUE);
+   m_pUpdate->dwFlags |= OBJ_UPDATE_IP_PROTO;
+   SetModified();
+}
+
+
+//
+// Set states of IP protocol selection controls
+//
+
+void CNetSrvPropsGeneral::SetProtocolCtrls()
+{
+   BOOL bEnable;
+
+   if (m_iServiceType == NETSRV_CUSTOM)
+   {
+      switch(m_iProto)
+      {
+         case IPPROTO_TCP:
+            SendDlgItemMessage(IDC_RADIO_TCP, BM_SETCHECK, BST_CHECKED, 0);
+            SendDlgItemMessage(IDC_RADIO_UDP, BM_SETCHECK, BST_UNCHECKED, 0);
+            SendDlgItemMessage(IDC_RADIO_ICMP, BM_SETCHECK, BST_UNCHECKED, 0);
+            SendDlgItemMessage(IDC_RADIO_OTHER, BM_SETCHECK, BST_UNCHECKED, 0);
+            break;
+         case IPPROTO_UDP:
+            SendDlgItemMessage(IDC_RADIO_TCP, BM_SETCHECK, BST_UNCHECKED, 0);
+            SendDlgItemMessage(IDC_RADIO_UDP, BM_SETCHECK, BST_CHECKED, 0);
+            SendDlgItemMessage(IDC_RADIO_ICMP, BM_SETCHECK, BST_UNCHECKED, 0);
+            SendDlgItemMessage(IDC_RADIO_OTHER, BM_SETCHECK, BST_UNCHECKED, 0);
+            break;
+         case IPPROTO_ICMP:
+            SendDlgItemMessage(IDC_RADIO_TCP, BM_SETCHECK, BST_UNCHECKED, 0);
+            SendDlgItemMessage(IDC_RADIO_UDP, BM_SETCHECK, BST_UNCHECKED, 0);
+            SendDlgItemMessage(IDC_RADIO_ICMP, BM_SETCHECK, BST_CHECKED, 0);
+            SendDlgItemMessage(IDC_RADIO_OTHER, BM_SETCHECK, BST_UNCHECKED, 0);
+            break;
+         default:
+            SendDlgItemMessage(IDC_RADIO_TCP, BM_SETCHECK, BST_UNCHECKED, 0);
+            SendDlgItemMessage(IDC_RADIO_UDP, BM_SETCHECK, BST_UNCHECKED, 0);
+            SendDlgItemMessage(IDC_RADIO_ICMP, BM_SETCHECK, BST_UNCHECKED, 0);
+            SendDlgItemMessage(IDC_RADIO_OTHER, BM_SETCHECK, BST_CHECKED, 0);
+            break;
+      }
+   }
+   else
+   {
+      SetDlgItemText(IDC_EDIT_PROTO, _T("6"));
+      SendDlgItemMessage(IDC_RADIO_TCP, BM_SETCHECK, BST_CHECKED, 0);
+      SendDlgItemMessage(IDC_RADIO_UDP, BM_SETCHECK, BST_UNCHECKED, 0);
+      SendDlgItemMessage(IDC_RADIO_ICMP, BM_SETCHECK, BST_UNCHECKED, 0);
+      SendDlgItemMessage(IDC_RADIO_OTHER, BM_SETCHECK, BST_UNCHECKED, 0);
+   }
+
+   bEnable = (m_iServiceType == NETSRV_CUSTOM) ? TRUE : FALSE;
+   EnableDlgItem(this, IDC_RADIO_TCP, bEnable);
+   EnableDlgItem(this, IDC_RADIO_UDP, bEnable);
+   EnableDlgItem(this, IDC_RADIO_ICMP, bEnable);
+   EnableDlgItem(this, IDC_RADIO_OTHER, bEnable);
+   EnableDlgItem(this, IDC_EDIT_PROTO, 
+                 SendDlgItemMessage(IDC_RADIO_OTHER, BM_GETCHECK) == BST_CHECKED);
+}
+
+
+//
+// Select IP address for binding
+//
+
+void CNetSrvPropsGeneral::OnSelectIp() 
+{
+   CObjectSelDlg dlg;
+   NXC_OBJECT *pObject;
+   DWORD i;
+
+   // Find host node
+   for(i = 0; i < m_pObject->dwNumParents; i++)
+   {
+      pObject = NXCFindObjectById(g_hSession, m_pObject->pdwParentList[i]);
+      if (pObject != NULL)
+      {
+         if (pObject->iClass == OBJECT_NODE)
+         {
+            dlg.m_dwParentObject = m_pObject->pdwParentList[i];
+            break;
+         }
+      }
+   }
+
+   if (dlg.m_dwParentObject != 0)
+   {
+      dlg.m_bSelectAddress = TRUE;
+      dlg.m_bSingleSelection = TRUE;
+      dlg.m_bAllowEmptySelection = TRUE;
+      if (dlg.DoModal() == IDOK)
+      {
+         if (dlg.m_dwNumObjects != 0)
+         {
+            pObject = NXCFindObjectById(g_hSession, dlg.m_pdwObjectList[0]);
+            if (pObject != NULL)
+            {
+               TCHAR szBuffer[16];
+
+               m_dwIpAddr = pObject->dwIpAddr;
+               SetDlgItemText(IDC_EDIT_IPADDR, IpToStr(m_dwIpAddr, szBuffer));
+            }
+         }
+         else
+         {
+            m_dwIpAddr = 0;
+            SetDlgItemText(IDC_EDIT_IPADDR, _T("<any>"));
+         }
+         m_pUpdate->dwFlags |= OBJ_UPDATE_IP_ADDR;
+         SetModified();
+      }
+   }
+   else
+   {
+      MessageBox(_T("Unable to determine host node for this service!"),
+                 _T("Internal Error"), MB_ICONSTOP | MB_OK);
+   }
+}
+
+
+//
+// Select poller node
+//
+
+void CNetSrvPropsGeneral::OnSelectPoller() 
+{
+   CObjectSelDlg dlg;
+
+   dlg.m_dwAllowedClasses = SCL_NODE;
+   dlg.m_bSingleSelection = TRUE;
+   dlg.m_bAllowEmptySelection = TRUE;
+   if (dlg.DoModal() == IDOK)
+   {
+      if (dlg.m_dwNumObjects != 0)
+      {
+         NXC_OBJECT *pNode;
+
+         m_dwPollerNode = dlg.m_pdwObjectList[0];
+         pNode = NXCFindObjectById(g_hSession, m_dwPollerNode);
+         if (pNode != NULL)
+         {
+            SetDlgItemText(IDC_EDIT_POLLER, pNode->szName);
+         }
+         else
+         {
+            SetDlgItemText(IDC_EDIT_POLLER, _T("<invalid>"));
+         }
+      }
+      else
+      {
+         m_dwPollerNode = 0;
+         SetDlgItemText(IDC_EDIT_POLLER, _T("<default>"));
+      }
+      m_pUpdate->dwFlags |= OBJ_UPDATE_POLLER_NODE;
+      SetModified();
+   }
+}
diff --git a/src/console/win32/NetSrvPropsGeneral.h b/src/console/win32/NetSrvPropsGeneral.h
new file mode 100644 (file)
index 0000000..5b3319e
--- /dev/null
@@ -0,0 +1,75 @@
+#if !defined(AFX_NETSRVPROPSGENERAL_H__4D3EE6BE_7BC7_49C8_8E6F_9133C27C8BD2__INCLUDED_)
+#define AFX_NETSRVPROPSGENERAL_H__4D3EE6BE_7BC7_49C8_8E6F_9133C27C8BD2__INCLUDED_
+
+#include "..\..\..\INCLUDE\nxclapi.h"  // Added by ClassView
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// NetSrvPropsGeneral.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CNetSrvPropsGeneral dialog
+
+class CNetSrvPropsGeneral : public CPropertyPage
+{
+       DECLARE_DYNCREATE(CNetSrvPropsGeneral)
+
+// Construction
+public:
+       NXC_OBJECT *m_pObject;
+       DWORD m_dwIpAddr;
+       DWORD m_dwPollerNode;
+       int m_iServiceType;
+       CNetSrvPropsGeneral();
+       ~CNetSrvPropsGeneral();
+
+// Dialog Data
+       //{{AFX_DATA(CNetSrvPropsGeneral)
+       enum { IDD = IDD_OBJECT_NETSRV_GENERAL };
+       CComboBox       m_wndTypeList;
+       DWORD   m_dwObjectId;
+       CString m_strName;
+       long    m_iPort;
+       CString m_strRequest;
+       CString m_strResponce;
+       long    m_iProto;
+       //}}AFX_DATA
+
+
+// Overrides
+       // ClassWizard generate virtual function overrides
+       //{{AFX_VIRTUAL(CNetSrvPropsGeneral)
+       public:
+       virtual void OnOK();
+       protected:
+       virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
+       //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+       void SetProtocolCtrls(void);
+       // Generated message map functions
+       //{{AFX_MSG(CNetSrvPropsGeneral)
+       virtual BOOL OnInitDialog();
+       afx_msg void OnChangeEditName();
+       afx_msg void OnSelchangeComboType();
+       afx_msg void OnChangeEditRequest();
+       afx_msg void OnChangeEditResponce();
+       afx_msg void OnRadioTcp();
+       afx_msg void OnRadioUdp();
+       afx_msg void OnRadioIcmp();
+       afx_msg void OnRadioOther();
+       afx_msg void OnSelectIp();
+       afx_msg void OnSelectPoller();
+       //}}AFX_MSG
+       DECLARE_MESSAGE_MAP()
+
+private:
+       NXC_OBJECT_UPDATE *m_pUpdate;
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_NETSRVPROPSGENERAL_H__4D3EE6BE_7BC7_49C8_8E6F_9133C27C8BD2__INCLUDED_)