- Various fixes related to trap management
authorVictor Kirhenshtein <victor@netxms.org>
Wed, 17 Nov 2004 12:06:36 +0000 (12:06 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Wed, 17 Nov 2004 12:06:36 +0000 (12:06 +0000)
- Explicit "#include <winsock2.h>" added to some headers to prevent conflicts with winsock.h

29 files changed:
.gitattributes
Makefile.am
TODO
include/nxclapi.h
src/agent/subagents/winperf/winperf.h
src/console/win32/EventSelDlg.cpp
src/console/win32/EventSelDlg.h
src/console/win32/MIBBrowserDlg.cpp
src/console/win32/MIBBrowserDlg.h
src/console/win32/Makefile.am
src/console/win32/ThresholdDlg.cpp
src/console/win32/TrapEditDlg.cpp
src/console/win32/TrapEditDlg.h
src/console/win32/TrapEditor.cpp
src/console/win32/TrapEditor.h
src/console/win32/TrapParamDlg.cpp [new file with mode: 0644]
src/console/win32/TrapParamDlg.h [new file with mode: 0644]
src/console/win32/nxcon.clw
src/console/win32/nxcon.dsp
src/console/win32/nxcon.rc
src/console/win32/resource.h
src/libnxcl/eventdb.cpp
src/libnxcl/libnxcl.h
src/libnxcl/snmptrap.cpp
src/server/core/snmptrap.cpp
src/server/dbdrv/mssql/mssqldrv.h
src/server/dbdrv/mysql/mysqldrv.h
src/server/dbdrv/odbc/odbcdrv.h
src/server/dbdrv/pgsql/pgsqldrv.h

index c7afa41..ac1392d 100644 (file)
@@ -318,6 +318,8 @@ src/console/win32/TrapEditDlg.cpp -text
 src/console/win32/TrapEditDlg.h -text
 src/console/win32/TrapEditor.cpp -text
 src/console/win32/TrapEditor.h -text
+src/console/win32/TrapParamDlg.cpp -text
+src/console/win32/TrapParamDlg.h -text
 src/console/win32/UserEditor.cpp -text
 src/console/win32/UserEditor.h -text
 src/console/win32/UserPropDlg.cpp -text
index 4f5904a..3f37c37 100644 (file)
@@ -8,5 +8,5 @@
 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
-EXTRA_DIST = reconf configure include
+EXTRA_DIST = reconf configure include netxms.dsw
 SUBDIRS = m4 contrib src doc sql images tools netware
diff --git a/TODO b/TODO
index fb0b56c..a980f90 100644 (file)
--- a/TODO
+++ b/TODO
@@ -20,6 +20,8 @@ GENERAL:
 - Add possibility to set different polling timeouts for different nodes
 - Add --with-client option to configure (should enable libnxcl and nxevent)
 - Optimize WaitForMessage method in message waiting queue class
+- Rewrite event management in a way to eliminate the need to unlock
+  event configuration to allow sending of new events
 
 
 SERVER:
index 3fb68d3..fbfaae9 100644 (file)
 
 
 //
-// Custom data types
-//
-
-typedef unsigned long HREQUEST;
-
-
-//
 // Some constants
 //
 
@@ -848,7 +841,6 @@ DWORD LIBNXCL_EXPORTABLE NXCConnect(TCHAR *szServer, TCHAR *szLogin, TCHAR *szPa
 void LIBNXCL_EXPORTABLE NXCDisconnect(void);
 void LIBNXCL_EXPORTABLE NXCSetEventHandler(NXC_EVENT_HANDLER pHandler);
 void LIBNXCL_EXPORTABLE NXCSetDebugCallback(NXC_DEBUG_CALLBACK pFunc);
-HREQUEST LIBNXCL_EXPORTABLE NXCRequest(DWORD dwOperation, ...);
 
 DWORD LIBNXCL_EXPORTABLE NXCSyncObjects(void);
 NXC_OBJECT LIBNXCL_EXPORTABLE *NXCFindObjectById(DWORD dwId);
@@ -884,7 +876,9 @@ DWORD LIBNXCL_EXPORTABLE NXCLockEventDB(void);
 DWORD LIBNXCL_EXPORTABLE NXCUnlockEventDB(void);
 BOOL LIBNXCL_EXPORTABLE NXCGetEventDB(NXC_EVENT_TEMPLATE ***pppTemplateList, DWORD *pdwNumRecords);
 const TCHAR LIBNXCL_EXPORTABLE *NXCGetEventName(DWORD dwId);
+BOOL LIBNXCL_EXPORTABLE NXCGetEventNameEx(DWORD dwId, TCHAR *pszBuffer, DWORD dwBufSize);
 int LIBNXCL_EXPORTABLE NXCGetEventSeverity(DWORD dwId);
+BOOL LIBNXCL_EXPORTABLE NXCGetEventText(DWORD dwId, TCHAR *pszBuffer, DWORD dwBufSize);
 DWORD LIBNXCL_EXPORTABLE NXCSendEvent(DWORD dwEventCode, DWORD dwObjectId, int iNumArgs, TCHAR **pArgList);
 
 DWORD LIBNXCL_EXPORTABLE NXCLoadUserDB(void);
index fd40d21..c67ae5a 100644 (file)
@@ -23,6 +23,7 @@
 #ifndef _winperf_h_
 #define _winperf_h_
 
+#include <winsock2.h>
 #include <windows.h>
 #include <nms_common.h>
 #include <nms_agent.h>
index e402614..639ab7c 100644 (file)
@@ -18,6 +18,7 @@ static char THIS_FILE[] = __FILE__;
 CEventSelDlg::CEventSelDlg(CWnd* pParent /*=NULL*/)
        : CDialog(CEventSelDlg::IDD, pParent)
 {
+   m_bSingleSelection = FALSE;
    m_pImageList = NULL;
    m_pdwEventList = NULL;
    m_iSortMode = theApp.GetProfileInt(_T("EventSelDlg"), _T("SortMode"), 0);
@@ -82,6 +83,11 @@ BOOL CEventSelDlg::OnInitDialog()
    m_wndListCtrl.InsertColumn(1, "Name", LVCFMT_LEFT, 
                               rect.right - 70 - GetSystemMetrics(SM_CXVSCROLL));
    m_wndListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT);
+   if (m_bSingleSelection)
+   {
+      ::SetWindowLong(m_wndListCtrl.m_hWnd, GWL_STYLE, 
+         ::GetWindowLong(m_wndListCtrl.m_hWnd, GWL_STYLE) | LVS_SINGLESEL);
+   }
        
    // Fill in event list
    NXCGetEventDB(&pList, &dwListSize);
index 3e8eb75..def8ba3 100644 (file)
@@ -14,6 +14,7 @@ class CEventSelDlg : public CDialog
 {
 // Construction
 public:
+       BOOL m_bSingleSelection;
        DWORD *m_pdwEventList;
        DWORD m_dwNumEvents;
        CEventSelDlg(CWnd* pParent = NULL);   // standard constructor
index 0075318..d54b736 100644 (file)
@@ -133,6 +133,7 @@ BOOL CMIBBrowserDlg::OnInitDialog()
    }
 
    // Disable "instance" field if it's not needed
+   // If instance is disabled, hide "Get..." button as well
    if (!m_bUseInstance)
    {
       CWnd *pWnd;
@@ -142,6 +143,10 @@ BOOL CMIBBrowserDlg::OnInitDialog()
       pWnd = GetDlgItem(IDC_STATIC_INSTANCE);
       if (pWnd != NULL)
          pWnd->EnableWindow(FALSE);
+
+      pWnd = GetDlgItem(IDC_BUTTON_GET);
+      if (pWnd != NULL)
+         pWnd->ShowWindow(SW_HIDE);
    }
 
        return TRUE;
@@ -398,3 +403,18 @@ void CMIBBrowserDlg::OnButtonGet()
       dlg.DoModal();
    }
 }
+
+
+//
+// Handler for "OK" button
+//
+
+void CMIBBrowserDlg::OnOK() 
+{
+   // To avoid errors in data exchange we should
+   // set input box text to correct number
+   if (!m_bUseInstance)
+      m_wndEditInstance.SetWindowText(_T("0"));
+       
+       CDialog::OnOK();
+}
index 12cc52b..e75eb87 100644 (file)
@@ -62,6 +62,7 @@ protected:
        afx_msg void OnChangeEditOid();
        afx_msg void OnChangeEditInstance();
        afx_msg void OnButtonGet();
+       virtual void OnOK();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 private:
index 71da782..32b0187 100644 (file)
@@ -78,6 +78,7 @@ EXTRA_DIST = \
        tools.cpp \
        TrapEditor.cpp TrapEditor.h \
        TrapEditDlg.cpp TrapEditDlg.h \
+       TrapParamDlg.cpp TrapParamDlg.h \
        UserEditor.cpp UserEditor.h \
        UserPropDlg.cpp UserPropDlg.h \
        UserSelectDlg.cpp UserSelectDlg.h
index b8e39df..659939b 100644 (file)
@@ -110,6 +110,7 @@ void CThresholdDlg::OnButtonSelect()
 {
    CEventSelDlg dlg;
 
+   dlg.m_bSingleSelection = TRUE;
    if (dlg.DoModal() == IDOK)
    {
       m_dwEventId = dlg.m_pdwEventList[0];
index cee8116..f5cf69c 100644 (file)
@@ -5,6 +5,7 @@
 #include "nxcon.h"
 #include "TrapEditDlg.h"
 #include "MIBBrowserDlg.h"
+#include "TrapParamDlg.h"
 
 #define NXSNMP_WITH_NET_SNMP
 #include <nxsnmp.h>
@@ -23,7 +24,6 @@ CTrapEditDlg::CTrapEditDlg(CWnd* pParent /*=NULL*/)
        : CDialog(CTrapEditDlg::IDD, pParent)
 {
        //{{AFX_DATA_INIT(CTrapEditDlg)
-               // NOTE: the ClassWizard will add member initialization here
        //}}AFX_DATA_INIT
 
    memset(&m_trap, 0, sizeof(NXC_TRAP_CFG_ENTRY));
@@ -43,10 +43,9 @@ void CTrapEditDlg::DoDataExchange(CDataExchange* pDX)
 {
        CDialog::DoDataExchange(pDX);
        //{{AFX_DATA_MAP(CTrapEditDlg)
+       DDX_Control(pDX, IDC_EVENT_ICON, m_wndEventIcon);
        DDX_Control(pDX, IDC_EDIT_DESCRIPTION, m_wndEditDescr);
        DDX_Control(pDX, IDC_EDIT_TRAP, m_wndEditOID);
-       DDX_Control(pDX, IDC_EDIT_EVENT, m_wndEditEvent);
-       DDX_Control(pDX, IDC_EDIT_MESSAGE, m_wndEditMsg);
        DDX_Control(pDX, IDC_LIST_ARGS, m_wndArgList);
        //}}AFX_DATA_MAP
 }
@@ -55,6 +54,8 @@ void CTrapEditDlg::DoDataExchange(CDataExchange* pDX)
 BEGIN_MESSAGE_MAP(CTrapEditDlg, CDialog)
        //{{AFX_MSG_MAP(CTrapEditDlg)
        ON_BN_CLICKED(IDC_SELECT_TRAP, OnSelectTrap)
+       ON_BN_CLICKED(IDC_SELECT_EVENT, OnSelectEvent)
+       ON_BN_CLICKED(IDC_BUTTON_ADD, OnButtonAdd)
        //}}AFX_MSG_MAP
 END_MESSAGE_MAP()
 
@@ -71,7 +72,6 @@ BOOL CTrapEditDlg::OnInitDialog()
    TCHAR szBuffer[1024];
    RECT rect;
    DWORD i;
-   int iItem;
 
        CDialog::OnInitDialog();
 
@@ -79,6 +79,8 @@ BOOL CTrapEditDlg::OnInitDialog()
    SNMPConvertOIDToText(m_trap.dwOidLen, m_trap.pdwObjectId, szBuffer, 1024);
    m_wndEditOID.SetWindowText(szBuffer);
 
+   UpdateEventInfo();
+
    // Setup parameter list
    m_wndArgList.SetExtendedStyle(LVS_EX_FULLROWSELECT);
    m_wndArgList.GetClientRect(&rect);
@@ -87,11 +89,7 @@ BOOL CTrapEditDlg::OnInitDialog()
                              rect.right - 50 - GetSystemMetrics(SM_CXVSCROLL));
    for(i = 0; i < m_trap.dwNumMaps; i++)
    {
-      _stprintf(szBuffer, _T("%d"), i + 2);
-      iItem = m_wndArgList.InsertItem(0x7FFFFFFF, szBuffer);
-      SNMPConvertOIDToText(m_trap.pMaps[i].dwOidLen, m_trap.pMaps[i].pdwObjectId,
-                           szBuffer, 1024);
-      m_wndArgList.SetItemText(iItem, 1, szBuffer);
+      AddParameterEntry(i);
    }
 
        return TRUE;
@@ -138,6 +136,92 @@ void CTrapEditDlg::OnOK()
       m_trap.pdwObjectId = (DWORD *)realloc(m_trap.pdwObjectId, sizeof(DWORD) * m_trap.dwOidLen);
       memcpy(m_trap.pdwObjectId, pdwOid, sizeof(DWORD) * m_trap.dwOidLen);
 
+      m_wndEditDescr.GetWindowText(m_trap.szDescription, MAX_DB_STRING);
+
        CDialog::OnOK();
    }
 }
+
+
+//
+// Update selected event information in appropriate controls
+//
+
+void CTrapEditDlg::UpdateEventInfo()
+{
+   TCHAR szBuffer[MAX_DB_STRING];
+   int iSeverity;
+   static UINT nIconID[] = { IDI_SEVERITY_NORMAL, IDI_SEVERITY_WARNING, IDI_SEVERITY_MINOR,
+                             IDI_SEVERITY_MAJOR, IDI_SEVERITY_CRITICAL };
+
+   NXCGetEventText(m_trap.dwEventId, szBuffer, MAX_DB_STRING);
+   SetDlgItemText(IDC_EDIT_MESSAGE, szBuffer);
+
+   NXCGetEventNameEx(m_trap.dwEventId, szBuffer, MAX_DB_STRING);
+   SetDlgItemText(IDC_EDIT_EVENT, szBuffer);
+
+   iSeverity = NXCGetEventSeverity(m_trap.dwEventId);
+   if (iSeverity != -1)
+      m_wndEventIcon.SetIcon(theApp.LoadIcon(nIconID[iSeverity]));
+   else
+      m_wndEventIcon.SetIcon(NULL);
+}
+
+
+//
+// Handler for "Select" button for event
+//
+
+void CTrapEditDlg::OnSelectEvent() 
+{
+   CEventSelDlg dlg;
+
+   dlg.m_bSingleSelection = TRUE;
+   if (dlg.DoModal() == IDOK)
+   {
+      m_trap.dwEventId = dlg.m_pdwEventList[0];
+      UpdateEventInfo();
+   }
+}
+
+
+//
+// Handler for "Add" button
+//
+
+void CTrapEditDlg::OnButtonAdd() 
+{
+   CTrapParamDlg dlg;
+   DWORD pdwOid[MAX_OID_LEN];
+
+   if (dlg.DoModal() == IDOK)
+   {
+      m_trap.pMaps = 
+         (NXC_OID_MAP *)realloc(m_trap.pMaps, sizeof(NXC_OID_MAP) * (m_trap.dwNumMaps + 1));
+      _tcsncpy(m_trap.pMaps[m_trap.dwNumMaps].szDescription, 
+               dlg.m_strDescription, MAX_DB_STRING);
+      m_trap.pMaps[m_trap.dwNumMaps].dwOidLen = 
+         SNMPParseOID(dlg.m_strOID, pdwOid, MAX_OID_LEN);
+      m_trap.pMaps[m_trap.dwNumMaps].pdwObjectId = 
+         (DWORD *)nx_memdup(pdwOid, sizeof(DWORD) * m_trap.pMaps[m_trap.dwNumMaps].dwOidLen);
+      AddParameterEntry(m_trap.dwNumMaps);
+      m_trap.dwNumMaps++;
+   }
+}
+
+
+//
+// Add new parameter mapping entry to list
+//
+
+void CTrapEditDlg::AddParameterEntry(DWORD dwIndex)
+{
+   TCHAR szBuffer[1024];
+   int iItem;
+
+   _stprintf(szBuffer, _T("%d"), dwIndex + 2);
+   iItem = m_wndArgList.InsertItem(0x7FFFFFFF, szBuffer);
+   SNMPConvertOIDToText(m_trap.pMaps[dwIndex].dwOidLen, m_trap.pMaps[dwIndex].pdwObjectId,
+                        szBuffer, 1024);
+   m_wndArgList.SetItemText(iItem, 1, szBuffer);
+}
index e98b0a1..e8aafb7 100644 (file)
@@ -22,10 +22,9 @@ public:
 // Dialog Data
        //{{AFX_DATA(CTrapEditDlg)
        enum { IDD = IDD_EDIT_TRAP };
+       CStatic m_wndEventIcon;
        CEdit   m_wndEditDescr;
        CEdit   m_wndEditOID;
-       CEdit   m_wndEditEvent;
-       CEdit   m_wndEditMsg;
        CListCtrl       m_wndArgList;
        //}}AFX_DATA
 
@@ -39,14 +38,19 @@ public:
 
 // Implementation
 protected:
+       void AddParameterEntry(DWORD dwIndex);
 
        // Generated message map functions
        //{{AFX_MSG(CTrapEditDlg)
        virtual BOOL OnInitDialog();
        afx_msg void OnSelectTrap();
        virtual void OnOK();
+       afx_msg void OnSelectEvent();
+       afx_msg void OnButtonAdd();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
+private:
+       void UpdateEventInfo(void);
 };
 
 //{{AFX_INSERT_LOCATION}}
index ec56653..7c0a3a8 100644 (file)
@@ -22,12 +22,14 @@ CTrapEditor::CTrapEditor()
 {
    m_pTrapList = NULL;
    m_dwNumTraps = 0;
+   m_pImageList = NULL;
 }
 
 CTrapEditor::~CTrapEditor()
 {
    if (m_pTrapList != NULL)
       NXCDestroyTrapList(m_dwNumTraps, m_pTrapList);
+   delete m_pImageList;
 }
 
 
@@ -74,6 +76,8 @@ int CTrapEditor::OnCreate(LPCREATESTRUCT lpCreateStruct)
                return -1;
        
    theApp.OnViewCreate(IDR_TRAP_EDITOR, this);
+
+   m_pImageList = CreateEventImageList();
        
    // Create list view control
    GetClientRect(&rect);
@@ -81,6 +85,7 @@ int CTrapEditor::OnCreate(LPCREATESTRUCT lpCreateStruct)
    m_wndListCtrl.SetExtendedStyle(LVS_EX_TRACKSELECT | LVS_EX_UNDERLINEHOT |
                                   LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
    m_wndListCtrl.SetHoverTime(0x7FFFFFFF);
+   m_wndListCtrl.SetImageList(m_pImageList, LVSIL_SMALL);
 
    // Setup columns
    m_wndListCtrl.InsertColumn(0, "ID", LVCFMT_LEFT, 40);
@@ -197,6 +202,10 @@ void CTrapEditor::UpdateItem(int iItem, DWORD dwIndex)
    m_wndListCtrl.SetItemText(iItem, 1, szBuffer);
    m_wndListCtrl.SetItemText(iItem, 2, NXCGetEventName(m_pTrapList[dwIndex].dwEventId));
    m_wndListCtrl.SetItemText(iItem, 3, m_pTrapList[dwIndex].szDescription);
+   
+   m_wndListCtrl.SetItem(iItem, 0, LVIF_IMAGE, NULL, 
+                         NXCGetEventSeverity(m_pTrapList[dwIndex].dwEventId),
+                         0, 0, 0);
 }
 
 
index 519f012..d4f0a41 100644 (file)
@@ -32,6 +32,7 @@ public:
 
 // Implementation
 protected:
+       CImageList *m_pImageList;
        void UpdateItem(int iItem, DWORD dwIndex);
        int AddItem(DWORD dwIndex);
        CListCtrl m_wndListCtrl;
diff --git a/src/console/win32/TrapParamDlg.cpp b/src/console/win32/TrapParamDlg.cpp
new file mode 100644 (file)
index 0000000..d208a6a
--- /dev/null
@@ -0,0 +1,70 @@
+// TrapParamDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "nxcon.h"
+#include "TrapParamDlg.h"
+#include "MIBBrowserDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CTrapParamDlg dialog
+
+
+CTrapParamDlg::CTrapParamDlg(CWnd* pParent /*=NULL*/)
+       : CDialog(CTrapParamDlg::IDD, pParent)
+{
+       //{{AFX_DATA_INIT(CTrapParamDlg)
+       m_strDescription = _T("");
+       m_strOID = _T("");
+       //}}AFX_DATA_INIT
+}
+
+
+void CTrapParamDlg::DoDataExchange(CDataExchange* pDX)
+{
+       CDialog::DoDataExchange(pDX);
+       //{{AFX_DATA_MAP(CTrapParamDlg)
+       DDX_Control(pDX, IDC_EDIT_OID, m_wndEditOID);
+       DDX_Text(pDX, IDC_EDIT_DESCRIPTION, m_strDescription);
+       DDV_MaxChars(pDX, m_strDescription, 255);
+       DDX_Text(pDX, IDC_EDIT_OID, m_strOID);
+       DDV_MaxChars(pDX, m_strOID, 1023);
+       //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CTrapParamDlg, CDialog)
+       //{{AFX_MSG_MAP(CTrapParamDlg)
+       ON_BN_CLICKED(IDC_SELECT_OID, OnSelectOid)
+       //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CTrapParamDlg message handlers
+
+
+//
+// Handler for "Select" button
+//
+
+void CTrapParamDlg::OnSelectOid() 
+{
+   CMIBBrowserDlg dlg;
+   TCHAR szBuffer[1024];
+
+   dlg.m_pNode = NULL;
+   m_wndEditOID.GetWindowText(szBuffer, 1024);
+   dlg.m_strOID = szBuffer;
+   if (dlg.DoModal() == IDOK)
+   {
+      _stprintf(szBuffer, _T(".%lu"), dlg.m_dwInstance);
+      dlg.m_strOID += szBuffer;
+      m_wndEditOID.SetWindowText(dlg.m_strOID);
+   }
+}
diff --git a/src/console/win32/TrapParamDlg.h b/src/console/win32/TrapParamDlg.h
new file mode 100644 (file)
index 0000000..073c27a
--- /dev/null
@@ -0,0 +1,48 @@
+#if !defined(AFX_TRAPPARAMDLG_H__476CD6B2_A577_4CA5_9190_157E15425BAE__INCLUDED_)
+#define AFX_TRAPPARAMDLG_H__476CD6B2_A577_4CA5_9190_157E15425BAE__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+// TrapParamDlg.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CTrapParamDlg dialog
+
+class CTrapParamDlg : public CDialog
+{
+// Construction
+public:
+       CTrapParamDlg(CWnd* pParent = NULL);   // standard constructor
+
+// Dialog Data
+       //{{AFX_DATA(CTrapParamDlg)
+       enum { IDD = IDD_EDIT_TRAP_ARG };
+       CEdit   m_wndEditOID;
+       CString m_strDescription;
+       CString m_strOID;
+       //}}AFX_DATA
+
+
+// Overrides
+       // ClassWizard generated virtual function overrides
+       //{{AFX_VIRTUAL(CTrapParamDlg)
+       protected:
+       virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
+       //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+
+       // Generated message map functions
+       //{{AFX_MSG(CTrapParamDlg)
+       afx_msg void OnSelectOid();
+       //}}AFX_MSG
+       DECLARE_MESSAGE_MAP()
+};
+
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_TRAPPARAMDLG_H__476CD6B2_A577_4CA5_9190_157E15425BAE__INCLUDED_)
index dc8152a..0da78e6 100644 (file)
@@ -2,35 +2,35 @@
 
 [General Info]
 Version=1
-LastClass=CTrapEditDlg
+LastClass=CTrapParamDlg
 LastTemplate=CDialog
 NewFileInclude1=#include "stdafx.h"
 NewFileInclude2=#include "nxcon.h"
 LastPage=0
 
-ClassCount=70
+ClassCount=71
 Class1=CConsoleApp
 Class3=CMainFrame
 Class4=CChildFrame
 Class7=CEventBrowser
 Class9=CMapView
 
-ResourceCount=91
+ResourceCount=92
 Resource1=IDD_THRESHOLD (English (U.S.))
-Resource2=IDR_MAINFRAME
+Resource2=IDD_MIB_BROWSER
 Resource3=IDM_VIEW_SPECIFIC (English (U.S.))
-Resource4=IDA_TRAP_EDITOR
-Resource5=IDD_DCI_TRANSFORM
+Resource4=IDD_NEW_ACTION
+Resource5=IDD_GROUP_PROPERTIES
 Class2=CChildView
 Class5=CAboutDlg
 Class6=CControlPanel
 Class8=CMapFrame
 Class10=CLoginDialog
-Resource6=IDA_MDI_DEFAULT
+Resource6=IDD_SELECT_EVENT
 Class11=CProgressDialog
-Resource7=IDD_SELECT_USER
+Resource7=IDD_EDIT_TRAP
 Class12=CObjectBrowser
-Resource8=IDD_DCI_COLLECTION
+Resource8=IDA_ALARM_BROWSER
 Class13=CObjectPropDlg
 Resource9=IDD_CP_GENERAL (English (U.S.))
 Resource10=IDA_OBJECT_BROWSER (English (U.S.))
@@ -46,7 +46,7 @@ Resource17=IDD_SET_PASSWORD (English (U.S.))
 Class16=CDebugFrame
 Resource18=IDD_OBJECT_SECURITY (English (U.S.))
 Resource19=IDD_OBJECT_PROPERTIES (English (U.S.))
-Resource20=IDD_LOGIN
+Resource20=IDD_SELECT_ACTION
 Class17=CObjectPreview
 Resource21=IDD_DCI_TRANSFORM (English (U.S.))
 Class18=CToolBox
@@ -59,32 +59,32 @@ Class23=CNodePropsGeneral
 Resource23=IDD_LOGIN (English (U.S.))
 Class24=CObjectPropCaps
 Class25=CObjectPropSheet
-Resource24=IDD_REQUEST_PROCESSING
+Resource24=IDD_DCI_TRANSFORM
 Class26=CRequestProcessingDlg
 Resource25=IDD_EDIT_EVENT (English (U.S.))
 Resource26=IDD_PROGRESS (English (U.S.))
-Resource27=IDD_EDIT_RULE_COMMENT
+Resource27=IDD_ABOUTBOX
 Resource28=IDD_USER_PROPERTIES (English (U.S.))
 Class27=CObjectPropsGeneral
 Resource29=IDA_ALARM_BROWSER (English (U.S.))
 Class28=CObjectPropsSecurity
 Resource30=IDD_CREATE_NODE (English (U.S.))
-Resource31=IDD_OBJECT_NODE_GENERAL
-Resource32=IDM_VIEW_SPECIFIC
+Resource31=IDD_CREATE_NODE
+Resource32=IDM_CONTEXT
 Class29=CUserSelectDlg
-Resource33=IDD_OBJECT_GENERAL
+Resource33=IDD_CREATE_TEMPLATE
 Class30=CUserEditor
 Resource34=IDD_DCI_PROPERTIES
 Class31=CNewUserDlg
-Resource35=IDD_THRESHOLD
-Resource36=IDM_CONTEXT
+Resource35=IDA_EVENT_EDITOR
+Resource36=IDM_VIEW_SPECIFIC
 Class32=CUserPropDlg
 Resource37=IDM_CONTEXT (English (U.S.))
-Resource38=IDD_ACTION_PROPERTIES
+Resource38=IDD_OBJECT_SECURITY
 Class33=CGroupPropDlg
-Resource39=IDD_OBJECT_CAPS
-Resource40=IDD_ABOUTBOX
-Resource41=IDD_CREATE_CONTAINER
+Resource39=IDD_CREATE_TG
+Resource40=IDD_ACTION_PROPERTIES
+Resource41=IDD_NEW_USER
 Resource42=IDD_SELECT_OBJECT (English (U.S.))
 Class34=CPasswordChangeDlg
 Class35=CNodeSummary
@@ -100,55 +100,55 @@ Class41=CGraphFrame
 Class42=CDCIThresholdsPage
 Resource46=IDA_MDI_DEFAULT (English (U.S.))
 Resource47=IDD_OBJECT_CAPS (English (U.S.))
-Resource48=IDA_ACTION_EDITOR
+Resource48=IDD_CP_GENERAL
 Class43=CThresholdDlg
 Resource49=IDD_SELECT_USER (English (U.S.))
-Resource50=IDD_CREATE_NODE
+Resource50=IDD_USER_PROPERTIES
 Class44=CMIBBrowserDlg
 Class45=CEventPolicyEditor
 Class46=CRuleList
 Class47=CRuleHeader
 Resource51=IDR_MAINFRAME (English (U.S.))
-Resource52=IDD_CP_GENERAL
+Resource52=IDD_REQUEST_PROCESSING
 Class48=CObjectSelDlg
-Resource53=IDD_SELECT_ACTION
-Resource54=IDD_EDIT_EVENT
+Resource53=IDD_SELECT_USER
+Resource54=IDD_CREATE_CONTAINER
 Class49=CRuleCommentDlg
-Resource55=IDA_ALARM_BROWSER
+Resource55=IDD_OBJECT_PRESENTATION
 Class50=CEventSelDlg
-Resource56=IDA_EPP
+Resource56=IDD_EDIT_RULE_COMMENT
 Resource57=IDD_REQUEST_PROCESSING (English (U.S.))
-Resource58=IDD_MIB_BROWSER
+Resource58=IDA_ACTION_EDITOR
 Resource59=IDD_ABOUTBOX (English (U.S.))
 Resource60=IDD_MIB_BROWSER (English (U.S.))
 Class51=CObjectPropsPresentation
 Resource61=IDD_OBJECT_PRESENTATION (English (U.S.))
-Resource62=IDD_EDIT_RULE_ALARM
+Resource62=IDD_OBJECT_CAPS
 Class52=CRuleSeverityDlg
-Resource63=IDD_OBJECT_SECURITY
+Resource63=IDD_DATA_QUERY
 Class53=CRuleAlarmDlg
 Class54=CAlarmBrowser
 Resource64=IDD_SELECT_EVENT (English (U.S.))
-Resource65=IDD_SET_PASSWORD
+Resource65=IDA_OBJECT_BROWSER
 Resource66=IDD_NEW_ACTION (English (U.S.))
 Resource67=IDD_DCI_COLLECTION (English (U.S.))
 Resource68=IDD_NEW_USER (English (U.S.))
 Class55=CConsolePropsGeneral
 Class56=CActionEditor
-Resource69=IDD_GROUP_PROPERTIES
-Resource70=IDD_DATA_QUERY
+Resource69=IDA_EPP
+Resource70=IDD_THRESHOLD
 Class57=CNewActionDlg
-Resource71=IDD_NEW_ACTION
+Resource71=IDD_OBJECT_GENERAL
 Class58=CEditActionDlg
-Resource72=IDD_OBJECT_PRESENTATION
+Resource72=IDD_EDIT_EVENT
 Class59=CActionSelDlg
-Resource73=IDD_USER_PROPERTIES
+Resource73=IDA_MDI_DEFAULT
 Resource74=IDD_EDIT_RULE_COMMENT (English (U.S.))
 Resource75=IDD_EDIT_RULE_ALARM (English (U.S.))
-Resource76=IDA_OBJECT_BROWSER
+Resource76=IDD_SELECT_OBJECT
 Class60=CCreateObjectDlg
 Class61=CCreateContainerDlg
-Resource77=IDA_NETMAP
+Resource77=IDD_EDIT_RULE_SEVERITY
 Class62=CCreateNodeDlg
 Resource78=IDA_EPP (English (U.S.))
 Resource79=IDD_CREATE_CONTAINER (English (U.S.))
@@ -158,20 +158,22 @@ Resource81=IDD_ACTION_PROPERTIES (English (U.S.))
 Class64=CPollNodeDlg
 Resource82=IDD_POLL_NODE (English (U.S.))
 Class65=CNodePoller
-Resource83=IDD_SELECT_EVENT
-Resource84=IDD_DCI_THRESHOLDS
+Resource83=IDD_LOGIN
+Resource84=IDA_NETMAP
 Class66=CCreateTemplateDlg
 Class67=CCreateTGDlg
-Resource85=IDD_SELECT_OBJECT
-Resource86=IDD_CREATE_TG
+Resource85=IDA_TRAP_EDITOR
+Resource86=IDD_SET_PASSWORD
 Class68=CTrapEditor
-Resource87=IDD_EDIT_RULE_SEVERITY
-Resource88=IDD_CREATE_TEMPLATE
-Resource89=IDA_EVENT_EDITOR
+Resource87=IDD_OBJECT_NODE_GENERAL
+Resource88=IDD_DCI_COLLECTION
+Resource89=IDD_EDIT_RULE_ALARM
 Class69=CDataQueryDlg
-Resource90=IDD_NEW_USER
+Resource90=IDR_MAINFRAME
 Class70=CTrapEditDlg
-Resource91=IDD_EDIT_TRAP
+Resource91=IDD_DCI_THRESHOLDS
+Class71=CTrapParamDlg
+Resource92=IDD_EDIT_TRAP_ARG
 
 [CLS:CConsoleApp]
 Type=0
@@ -2342,7 +2344,7 @@ LastObject=CDataQueryDlg
 [DLG:IDD_EDIT_TRAP]
 Type=1
 Class=CTrapEditDlg
-ControlCount=18
+ControlCount=19
 Control1=IDC_EDIT_DESCRIPTION,edit,1350631552
 Control2=IDC_EDIT_TRAP,edit,1350631552
 Control3=IDC_SELECT_TRAP,button,1342242816
@@ -2351,16 +2353,17 @@ Control5=IDC_SELECT_EVENT,button,1342242816
 Control6=IDC_EDIT_MESSAGE,edit,1350633600
 Control7=IDC_LIST_ARGS,SysListView32,1342275849
 Control8=IDC_BUTTON_ADD,button,1342242816
-Control9=IDC_BUTTON_UP,button,1342242816
-Control10=IDC_BUTTON_DOWN,button,1342242816
-Control11=IDC_BUTTON_DELETE,button,1342242816
-Control12=IDOK,button,1342242817
-Control13=IDCANCEL,button,1342242816
-Control14=IDC_EVENT_ICON,static,1342177283
-Control15=IDC_STATIC,button,1342177287
+Control9=IDC_BUTTON_EDIT,button,1342242816
+Control10=IDC_BUTTON_DELETE,button,1342242816
+Control11=IDC_BUTTON_UP,button,1342242816
+Control12=IDC_BUTTON_DOWN,button,1342242816
+Control13=IDOK,button,1342242817
+Control14=IDCANCEL,button,1342242816
+Control15=IDC_EVENT_ICON,static,1342177283
 Control16=IDC_STATIC,button,1342177287
 Control17=IDC_STATIC,button,1342177287
 Control18=IDC_STATIC,button,1342177287
+Control19=IDC_STATIC,button,1342177287
 
 [CLS:CTrapEditDlg]
 Type=0
@@ -2371,3 +2374,24 @@ Filter=D
 VirtualFilter=dWC
 LastObject=CTrapEditDlg
 
+[DLG:IDD_EDIT_TRAP_ARG]
+Type=1
+Class=CTrapParamDlg
+ControlCount=7
+Control1=IDC_EDIT_DESCRIPTION,edit,1350631552
+Control2=IDC_EDIT_OID,edit,1350631552
+Control3=IDC_SELECT_OID,button,1342242816
+Control4=IDOK,button,1342242817
+Control5=IDCANCEL,button,1342242816
+Control6=IDC_STATIC,static,1342308352
+Control7=IDC_STATIC,static,1342308352
+
+[CLS:CTrapParamDlg]
+Type=0
+HeaderFile=TrapParamDlg.h
+ImplementationFile=TrapParamDlg.cpp
+BaseClass=CDialog
+Filter=D
+LastObject=CTrapParamDlg
+VirtualFilter=dWC
+
index e7e44d1..24f1a73 100644 (file)
@@ -366,6 +366,10 @@ SOURCE=.\TrapEditor.cpp
 # End Source File
 # Begin Source File
 
+SOURCE=.\TrapParamDlg.cpp
+# End Source File
+# Begin Source File
+
 SOURCE=.\UserEditor.cpp
 # End Source File
 # Begin Source File
@@ -650,6 +654,10 @@ SOURCE=.\TrapEditor.h
 # End Source File
 # Begin Source File
 
+SOURCE=.\TrapParamDlg.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\UserEditor.h
 # End Source File
 # Begin Source File
index 68c5976..48e3c73 100644 (file)
@@ -1339,7 +1339,7 @@ BEGIN
     LTEXT           "Static",IDC_STATIC_PARAMETER,46,18,237,8
 END
 
-IDD_EDIT_TRAP DIALOGEX 0, 0, 271, 247
+IDD_EDIT_TRAP DIALOGEX 0, 0, 271, 258
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Trap Configuration"
 FONT 8, "MS Sans Serif"
@@ -1348,25 +1348,40 @@ BEGIN
     EDITTEXT        IDC_EDIT_TRAP,13,50,189,14,ES_AUTOHSCROLL
     PUSHBUTTON      "&Select...",IDC_SELECT_TRAP,208,50,50,14
     EDITTEXT        IDC_EDIT_EVENT,40,82,162,14,ES_AUTOHSCROLL | ES_READONLY
-    PUSHBUTTON      "S&elect...",IDC_SELECT_EVENT,207,82,50,14
+    PUSHBUTTON      "Sele&ct...",IDC_SELECT_EVENT,207,82,50,14
     EDITTEXT        IDC_EDIT_MESSAGE,40,102,218,14,ES_AUTOHSCROLL | 
                     ES_READONLY
     CONTROL         "List1",IDC_LIST_ARGS,"SysListView32",LVS_REPORT | 
                     LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | LVS_NOSORTHEADER | 
-                    WS_TABSTOP,13,137,189,77,WS_EX_CLIENTEDGE
+                    WS_TABSTOP,13,137,189,87,WS_EX_CLIENTEDGE
     PUSHBUTTON      "&Add...",IDC_BUTTON_ADD,208,137,50,14
-    PUSHBUTTON      "Move &up",IDC_BUTTON_UP,208,158,50,14
-    PUSHBUTTON      "&Move down",IDC_BUTTON_DOWN,208,179,50,14
-    PUSHBUTTON      "&Delete",IDC_BUTTON_DELETE,208,200,50,14
-    DEFPUSHBUTTON   "OK",IDOK,158,226,50,14
-    PUSHBUTTON      "Cancel",IDCANCEL,214,226,50,14
+    PUSHBUTTON      "&Edit...",IDC_BUTTON_EDIT,208,155,50,14
+    PUSHBUTTON      "&Delete",IDC_BUTTON_DELETE,208,173,50,14
+    PUSHBUTTON      "Move &up",IDC_BUTTON_UP,208,191,50,14
+    PUSHBUTTON      "&Move down",IDC_BUTTON_DOWN,208,209,50,14
+    DEFPUSHBUTTON   "OK",IDOK,158,237,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,214,237,50,14
     ICON            "",IDC_EVENT_ICON,14,86,21,20
     GROUPBOX        "Trap OID",IDC_STATIC,7,40,257,30
     GROUPBOX        "Event",IDC_STATIC,7,73,257,49
-    GROUPBOX        "Parameter bindings",IDC_STATIC,7,126,257,94
+    GROUPBOX        "Parameter bindings",IDC_STATIC,7,126,257,104
     GROUPBOX        "Description",IDC_STATIC,7,7,257,31
 END
 
+IDD_EDIT_TRAP_ARG DIALOG DISCARDABLE  0, 0, 273, 70
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Trap Parameter"
+FONT 8, "MS Sans Serif"
+BEGIN
+    EDITTEXT        IDC_EDIT_DESCRIPTION,7,18,202,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_OID,7,48,147,14,ES_AUTOHSCROLL
+    PUSHBUTTON      "&Select...",IDC_SELECT_OID,159,48,50,14
+    DEFPUSHBUTTON   "OK",IDOK,216,7,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,216,24,50,14
+    LTEXT           "Description",IDC_STATIC,7,7,36,8
+    LTEXT           "Varbind OID",IDC_STATIC,7,37,40,8
+END
+
 
 #ifndef _MAC
 /////////////////////////////////////////////////////////////////////////////
@@ -1688,7 +1703,15 @@ BEGIN
         LEFTMARGIN, 7
         RIGHTMARGIN, 264
         TOPMARGIN, 7
-        BOTTOMMARGIN, 240
+        BOTTOMMARGIN, 251
+    END
+
+    IDD_EDIT_TRAP_ARG, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 266
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 63
     END
 END
 #endif    // APSTUDIO_INVOKED
index e25aaa4..ae1d2ab 100644 (file)
 #define IDA_TRAP_EDITOR                 243
 #define IDD_DATA_QUERY                  244
 #define IDD_EDIT_TRAP                   245
+#define IDD_EDIT_TRAP_ARG               246
 #define ID_EDIT_BOX                     525
 #define IDC_EDIT_SERVER                 1000
 #define IDC_EDIT_LOGIN                  1001
 #define IDC_BUTTON_UP                   1198
 #define IDC_BUTTON_DOWN                 1199
 #define IDC_STATIC_INSTANCE             1201
+#define IDC_SELECT_OID                  1202
+#define IDC_BUTTON_EDIT                 1203
 #define ID_VIEW_CONTROLPANEL            32771
 #define ID_VIEW_EVENTS                  32774
 #define ID_VIEW_MAP                     32776
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_3D_CONTROLS                     1
-#define _APS_NEXT_RESOURCE_VALUE        246
+#define _APS_NEXT_RESOURCE_VALUE        247
 #define _APS_NEXT_COMMAND_VALUE         32904
-#define _APS_NEXT_CONTROL_VALUE         1202
+#define _APS_NEXT_CONTROL_VALUE         1204
 #define _APS_NEXT_SYMED_VALUE           120
 #endif
 #endif
index 3201d4d..0bf3c23 100644 (file)
@@ -284,7 +284,6 @@ BOOL LIBNXCL_EXPORTABLE NXCGetEventDB(NXC_EVENT_TEMPLATE ***pppTemplateList, DWO
 }
 
 
-
 //
 // Resolve event id to name
 //
@@ -306,6 +305,28 @@ const TCHAR LIBNXCL_EXPORTABLE *NXCGetEventName(DWORD dwId)
 
 
 //
+// Resolve event id to name using application-provided buffer
+//
+
+BOOL LIBNXCL_EXPORTABLE NXCGetEventNameEx(DWORD dwId, TCHAR *pszBuffer, DWORD dwBufSize)
+{
+   DWORD i;
+
+   MutexLock(m_mutexEventAccess, INFINITE);
+   for(i = 0; i < m_dwNumTemplates; i++)
+      if (m_ppEventTemplates[i]->dwCode == dwId)
+      {
+         _tcsncpy(pszBuffer, m_ppEventTemplates[i]->szName, dwBufSize);
+         MutexUnlock(m_mutexEventAccess);
+         return TRUE;
+      }
+   MutexUnlock(m_mutexEventAccess);
+   *pszBuffer = 0;
+   return FALSE;
+}
+
+
+//
 // Get severity for given event id. Will return -1 for unknown id.
 //
 
@@ -364,3 +385,26 @@ DWORD LIBNXCL_EXPORTABLE NXCUnlockEventDB(void)
 {
    return DoEventDBLock(FALSE);
 }
+
+
+//
+// Get text of event template with given ID.
+// If there are no template with such ID, empty string will be returned.
+//
+
+BOOL LIBNXCL_EXPORTABLE NXCGetEventText(DWORD dwId, TCHAR *pszBuffer, DWORD dwBufSize)
+{
+   DWORD i;
+
+   MutexLock(m_mutexEventAccess, INFINITE);
+   for(i = 0; i < m_dwNumTemplates; i++)
+      if (m_ppEventTemplates[i]->dwCode == dwId)
+      {
+         _tcsncpy(pszBuffer, m_ppEventTemplates[i]->pszMessage, dwBufSize);
+         MutexUnlock(m_mutexEventAccess);
+         return TRUE;
+      }
+   MutexUnlock(m_mutexEventAccess);
+   *pszBuffer = 0;
+   return FALSE;
+}
index 0da9460..fceaa18 100644 (file)
@@ -58,19 +58,6 @@ typedef struct
 
 
 //
-// Request structure
-//
-
-typedef struct
-{
-   DWORD dwCode;
-   void *pArg;
-   BOOL bDynamicArg;
-   HREQUEST dwHandle;
-} REQUEST;
-
-
-//
 // Functions
 //
 
index a5bb57e..1c61d4e 100644 (file)
@@ -163,7 +163,7 @@ void LIBNXCL_EXPORTABLE NXCDestroyTrapList(DWORD dwNumTraps, NXC_TRAP_CFG_ENTRY
 
    for(i = 0; i < dwNumTraps; i++)
    {
-      for(j = 0; i < pTrapList[i].dwNumMaps; j++)
+      for(j = 0; j < pTrapList[i].dwNumMaps; j++)
          safe_free(pTrapList[i].pMaps[j].pdwObjectId);
       safe_free(pTrapList[i].pMaps);
       safe_free(pTrapList[i].pdwObjectId);
index 327be8c..5fca6dd 100644 (file)
@@ -72,6 +72,7 @@ static BOOL LoadTrapCfg(void)
          }
          m_pTrapCfg[i].dwEventId = DBGetFieldULong(hResult, i, 2);
          _tcsncpy(m_pTrapCfg[i].szDescription, DBGetField(hResult, i, 3), MAX_DB_STRING);
+         DecodeSQLString(m_pTrapCfg[i].szDescription);
       }
       DBFreeResult(hResult);
 
@@ -100,6 +101,7 @@ static BOOL LoadTrapCfg(void)
                   bResult = FALSE;
                }
                _tcsncpy(m_pTrapCfg[i].pMaps[j].szDescription, DBGetField(hResult, j, 1), MAX_DB_STRING);
+               DecodeSQLString(m_pTrapCfg[i].pMaps[j].szDescription);
             }
             DBFreeResult(hResult);
          }
@@ -395,6 +397,9 @@ DWORD CreateNewTrap(DWORD *pdwTrapId)
 
    _stprintf(szQuery, _T("INSERT INTO snmp_trap_cfg (trap_id,snmp_oid,event_id,description) ")
                       _T("VALUES (%ld,'',%d,'')"), *pdwTrapId, EVENT_SNMP_UNMATCHED_TRAP);
+   if (!DBQuery(g_hCoreDB, szQuery))
+      dwResult = RCC_DB_FAILURE;
+
    return dwResult;
 }
 
index dc1cf64..e500a86 100644 (file)
@@ -24,6 +24,7 @@
 #define _mssqldrv_h_
 
 #ifdef _WIN32
+#include <winsock2.h>
 #include <windows.h>
 #define EXPORT __declspec(dllexport)
 #define DBNTWIN32
index 512643a..5bc89c5 100644 (file)
@@ -24,6 +24,7 @@
 #define _mysqldrv_h_
 
 #ifdef _WIN32
+#include <winsock2.h>
 #include <windows.h>
 #define EXPORT __declspec(dllexport)
 #else
index 74015ab..147ea0d 100644 (file)
@@ -24,6 +24,7 @@
 #define _odbcdrv_h_
 
 #ifdef _WIN32
+#include <winsock2.h>
 #include <windows.h>
 #define EXPORT __declspec(dllexport)
 #else
index 9ce1335..181f59f 100644 (file)
@@ -24,6 +24,7 @@
 #define _pgsqldrv_h_
 
 #ifdef _WIN32
+#include <winsock2.h>
 #include <windows.h>
 #define EXPORT __declspec(dllexport)
 #else