event forwarding implemented
authorVictor Kirhenshtein <victor@netxms.org>
Mon, 1 Dec 2008 20:45:05 +0000 (20:45 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Mon, 1 Dec 2008 20:45:05 +0000 (20:45 +0000)
25 files changed:
.gitattributes
ChangeLog
doc/internal/db_format_change.txt
include/netxms_isc.h
include/netxmsdb.h
sql/setup.in
src/console/win32/ActionEditor.cpp
src/console/win32/ActionSelDlg.cpp
src/console/win32/EditActionDlg.cpp
src/console/win32/EditActionDlg.h
src/console/win32/EventPolicyEditor.cpp
src/console/win32/globals.cpp
src/console/win32/icons/Makefile.am
src/console/win32/icons/fwd_event.ico [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/server/core/actions.cpp
src/server/core/ef.cpp
src/server/core/isc.cpp
src/server/core/main.cpp
src/server/core/session.cpp
src/server/libnxsrv/isc.cpp
src/server/tools/nxdbmgr/upgrade.cpp

index 9eecd36..4673dd8 100644 (file)
@@ -3,6 +3,7 @@ contrib/backgrounds/.keep -text
 contrib/logo.jpg -text
 doc/comparison_netxms_nnm.doc -text
 doc/internal/build.w64 -text
+doc/internal/db_format_change.txt svneol=native#unset
 doc/internal/netxms_architecture.vsd -text
 doc/manuals/client_library.doc -text
 doc/manuals/netxms_install_guide.odt -text
@@ -212,6 +213,7 @@ src/console/win32/icons/find.ico -text
 src/console/win32/icons/folder_c.ico -text
 src/console/win32/icons/folder_o.ico -text
 src/console/win32/icons/forward.ico -text
+src/console/win32/icons/fwd_event.ico -text
 src/console/win32/icons/go_parent.ico -text
 src/console/win32/icons/graph.ico -text
 src/console/win32/icons/home.ico -text
index 87b5a14..39525b5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 * 0.2.23
 *
 
+- Implemented event forwarding between NetXMS servers
 - Added new subagent LOGWATCH for log monitoring
 - Implemented syslog message monitoring on built-in syslog server
 - New agent configuration parameter: WaitForProcess
index bb53449..7bf2ffa 100644 (file)
Binary files a/doc/internal/db_format_change.txt and b/doc/internal/db_format_change.txt differ
index fb29fa9..d844e42 100644 (file)
 #define ISC_ERR_INVALID_SESSION_KEY    ((DWORD)14)\r
 #define ISC_ERR_INTERNAL_ERROR         ((DWORD)15)\r
 #define ISC_ERR_SESSION_SETUP_FAILED   ((DWORD)16)\r
+#define ISC_ERR_OBJECT_NOT_FOUND       ((DWORD)17)\r
+#define ISC_ERR_POST_EVENT_FAILED      ((DWORD)18)\r
+\r
+\r
+//\r
+// ISC session\r
+//\r
+\r
+class ISCSession\r
+{\r
+private:\r
+       SOCKET m_socket;\r
+       DWORD m_peerAddress;    // Peer address in host byte order\r
+       void *m_userData;\r
+\r
+public:\r
+       ISCSession(SOCKET sock, struct sockaddr_in *addr)\r
+       {\r
+               m_socket = sock;\r
+               m_peerAddress = ntohl(addr->sin_addr.s_addr);\r
+               m_userData = NULL;\r
+       }\r
+\r
+       SOCKET GetSocket() { return m_socket; }\r
+       DWORD GetPeerAddress() { return m_peerAddress; }\r
+\r
+       void SetUserData(void *data) { m_userData = data; }\r
+       void *GetUserData() { return m_userData; }\r
+};\r
 \r
 \r
 //\r
@@ -75,9 +104,9 @@ typedef struct
        DWORD id;                                                               // Service ID\r
        const TCHAR *name;                                      // Name\r
        const TCHAR *enableParameter;           // Server parameter to be set to enable service\r
-       void *(*setupSession)(CSCPMessage *);  // Session setup handler\r
-       void (*closeSession)(void *);          // Session close handler\r
-       BOOL (*processMsg)(void *, CSCPMessage *, CSCPMessage *);\r
+       BOOL (*setupSession)(ISCSession *, CSCPMessage *);  // Session setup handler\r
+       void (*closeSession)(ISCSession *);          // Session close handler\r
+       BOOL (*processMsg)(ISCSession *, CSCPMessage *, CSCPMessage *);\r
 } ISC_SERVICE;\r
 
 
index 25cd6a5..0e5adab 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef _netxmsdb_h
 #define _netxmsdb_h
 
-#define DB_FORMAT_VERSION   83
+#define DB_FORMAT_VERSION   84
 
 #endif
index 795cba3..d6c5430 100644 (file)
@@ -192,6 +192,10 @@ INSERT INTO config (var_name,var_value,is_visible,need_server_restart)
        VALUES ('EnableAgentRegistration','1',1,0);
 INSERT INTO config (var_name,var_value,is_visible,need_server_restart)
        VALUES ('AnonymousFileAccess','0',1,0);
+INSERT INTO config (var_name,var_value,is_visible,need_server_restart)
+       VALUES ('EnableISCListener','0',1,1);
+INSERT INTO config (var_name,var_value,is_visible,need_server_restart)
+       VALUES ('ReceiveForwardedEvents','0',1,0);
 
 
 /*
index e6dd13c..59a4940 100644 (file)
@@ -91,6 +91,7 @@ int CActionEditor::OnCreate(LPCREATESTRUCT lpCreateStruct)
    m_imageList.Add(AfxGetApp()->LoadIcon(IDI_REXEC));
    m_imageList.Add(AfxGetApp()->LoadIcon(IDI_EMAIL));
    m_imageList.Add(AfxGetApp()->LoadIcon(IDI_SMS));
+   m_imageList.Add(AfxGetApp()->LoadIcon(IDI_FORWARD_EVENT));
    m_iSortImageBase = m_imageList.GetImageCount();
    m_imageList.Add(theApp.LoadIcon(IDI_SORT_UP));
    m_imageList.Add(theApp.LoadIcon(IDI_SORT_DOWN));
index 1e2e2c7..451988f 100644 (file)
@@ -68,6 +68,7 @@ BOOL CActionSelDlg::OnInitDialog()
    m_imageList.Add(AfxGetApp()->LoadIcon(IDI_REXEC));
    m_imageList.Add(AfxGetApp()->LoadIcon(IDI_EMAIL));
    m_imageList.Add(AfxGetApp()->LoadIcon(IDI_SMS));
+   m_imageList.Add(AfxGetApp()->LoadIcon(IDI_FORWARD_EVENT));
 
    // Setup list control
    m_wndListCtrl.SetImageList(&m_imageList, LVSIL_SMALL);
index 4e4a586..d6028f8 100644 (file)
@@ -53,6 +53,7 @@ BEGIN_MESSAGE_MAP(CEditActionDlg, CDialog)
        ON_BN_CLICKED(IDC_RADIO_EXEC, OnRadioExec)
        ON_BN_CLICKED(IDC_RADIO_REXEC, OnRadioRexec)
        ON_BN_CLICKED(IDC_RADIO_SMS, OnRadioSms)
+       ON_BN_CLICKED(IDC_RADIO_FORWARD, OnRadioForward)
        //}}AFX_MSG_MAP
 END_MESSAGE_MAP()
 
@@ -87,20 +88,23 @@ void CEditActionDlg::OnTypeChange()
       { FALSE, FALSE, FALSE, FALSE, TRUE, TRUE },
       { TRUE, TRUE, FALSE, FALSE, TRUE, TRUE },
       { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE },
-      { TRUE, TRUE, FALSE, FALSE, TRUE, TRUE }
+      { TRUE, TRUE, FALSE, FALSE, TRUE, TRUE },
+      { TRUE, TRUE, FALSE, FALSE, FALSE, FALSE }
    };
    static TCHAR *pszRcptTitles[] = 
    { 
       _T("Recipient address"),
       _T("Remote host"),
       _T("Recipient address"),
-      _T("Recipient phone number")
+      _T("Recipient phone number"),
+      _T("Remote NetXMS server")
    };
    static TCHAR *pszDataTitles[] = 
    { 
       _T("Command"),
       _T("Action"),
       _T("Message text"),
+      _T("Message text"),
       _T("Message text")
    };
    int i;
@@ -118,24 +122,30 @@ void CEditActionDlg::OnTypeChange()
 
 void CEditActionDlg::OnRadioEmail() 
 {
-   m_iType = 2;
+   m_iType = ACTION_SEND_EMAIL;
    OnTypeChange();
 }
 
 void CEditActionDlg::OnRadioExec() 
 {
-   m_iType = 0;
+   m_iType = ACTION_EXEC;
    OnTypeChange();
 }
 
 void CEditActionDlg::OnRadioRexec() 
 {
-   m_iType = 1;
+   m_iType = ACTION_REMOTE;
    OnTypeChange();
 }
 
 void CEditActionDlg::OnRadioSms() 
 {
-   m_iType = 3;
+   m_iType = ACTION_SEND_SMS;
+   OnTypeChange();
+}
+
+void CEditActionDlg::OnRadioForward() 
+{
+   m_iType = ACTION_FORWARD_EVENT;
    OnTypeChange();
 }
index 5c5ab84..6b3f127 100644 (file)
@@ -45,6 +45,7 @@ protected:
        afx_msg void OnRadioExec();
        afx_msg void OnRadioRexec();
        afx_msg void OnRadioSms();
+       afx_msg void OnRadioForward();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 };
index 693cec2..cc84863 100644 (file)
@@ -152,6 +152,7 @@ int CEventPolicyEditor::OnCreate(LPCREATESTRUCT lpCreateStruct)
    m_pImageList->Add(theApp.LoadIcon(IDI_REXEC));
    m_pImageList->Add(theApp.LoadIcon(IDI_EMAIL));
    m_pImageList->Add(theApp.LoadIcon(IDI_SMS));
+   m_pImageList->Add(theApp.LoadIcon(IDI_FORWARD_EVENT));
    m_iImageOptionsBase = m_pImageList->GetImageCount();
    m_pImageList->Add(theApp.LoadIcon(IDI_STOP));
        
index 5afa00d..2f8f662 100644 (file)
@@ -101,7 +101,7 @@ TCHAR *g_szObjectClass[] = { _T("Generic"), _T("Subnet"), _T("Node"), _T("Interf
                              _T("Container"), _T("Zone"), _T("ServiceRoot"), _T("Template"), 
                              _T("TemplateGroup"), _T("TemplateRoot"), _T("NetworkService"),
                              _T("VPNConnector"), _T("Condition"), _T("Cluster") };
-TCHAR *g_szActionType[] = { _T("Execute"), _T("Remote"), _T("E-Mail"), _T("SMS") };
+TCHAR *g_szActionType[] = { _T("Execute"), _T("Remote"), _T("E-Mail"), _T("SMS"), _T("Forward") };
 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"),
index 5311955..9b36281 100644 (file)
@@ -26,4 +26,5 @@ EXTRA_DIST = \
        discovery.ico exit.ico template_root.ico cluster.ico server.ico \
        cert.ico certmgr.ico topology.ico empty.ico subordinates.ico \
        redo_layout.ico find.ico next.ico stop.ico situation.ico \
-       instance.ico event_corr.ico package.ico database.ico desktop.ico
+       instance.ico event_corr.ico package.ico database.ico desktop.ico \
+       fwd_event.ico
diff --git a/src/console/win32/icons/fwd_event.ico b/src/console/win32/icons/fwd_event.ico
new file mode 100644 (file)
index 0000000..5898e3f
Binary files /dev/null and b/src/console/win32/icons/fwd_event.ico differ
index af1988b..2fd2732 100644 (file)
@@ -17,20 +17,20 @@ Class9=CMapView
 
 ResourceCount=258
 Resource1=IDD_EDIT_TRAP (English (U.S.))
-Resource2=IDM_VIEW_SPECIFIC
+Resource2=IDM_CONTEXT
 Resource3=IDD_EDIT_RULE_SCRIPT (English (U.S.))
-Resource4=IDD_OBJECT_CLUSTER_RESOURCES
-Resource5=IDD_NEW_USER
+Resource4=IDD_CREATE_NETSRV
+Resource5=IDD_SET_CHILD_MGMT_STATUS
 Class2=CChildView
 Class5=CAboutDlg
 Class6=CControlPanel
 Class8=CMapFrame
 Class10=CLoginDialog
-Resource6=IDA_NETMAP
+Resource6=IDA_PACKAGE_MGR
 Class11=CProgressDialog
-Resource7=IDA_MAP_MANAGER
+Resource7=IDD_CREATE_CLUSTER
 Class12=CAddrEntryDlg
-Resource8=IDD_SELECT_MAP
+Resource8=IDD_OBJTOOL_GENERAL
 Class13=CObjectPropDlg
 Resource9=IDD_ACTION_PROPERTIES (English (U.S.))
 Resource10=IDA_AGENT_CFG_EDITOR (English (U.S.))
@@ -46,45 +46,45 @@ Resource17=IDD_NEW_USER (English (U.S.))
 Class16=CDebugFrame
 Resource18=IDA_EPP (English (U.S.))
 Resource19=IDD_OBJECT_PROPERTIES (English (U.S.))
-Resource20=IDA_PACKAGE_MGR
+Resource20=IDD_OBJECT_COND_DATA
 Class17=CObjectPreview
 Resource21=IDA_TRAP_EDITOR (English (U.S.))
 Class18=CToolBox
 Class19=CObjectInfoBox
 Class20=CObjectSearchBox
-Resource22=IDD_SNMP_WALK
+Resource22=IDD_SELECT_OBJECT
 Class21=CEditBox
 Class22=COPGeneral
 Class23=CNodePropsGeneral
 Resource23=IDD_GRAPH_PROPERTIES (English (U.S.))
 Class24=CObjectPropCaps
 Class25=CObjectPropSheet
-Resource24=IDD_EDIT_EVENT
+Resource24=IDD_OBJECT_CLUSTER_RESOURCES
 Class26=CRequestProcessingDlg
 Resource25=IDD_CREATE_IF_DCI (English (U.S.))
 Resource26=IDD_PROGRESS (English (U.S.))
-Resource27=IDD_SET_PASSWORD
+Resource27=IDD_OBJECT_IF_GENERAL
 Resource28=IDD_THRESHOLD (English (U.S.))
 Class27=CObjectPropsGeneral
 Resource29=IDD_OBJTOOL_OPTIONS (English (U.S.))
 Class28=CObjectPropsSecurity
 Resource30=IDD_OBJECT_NETSRV_GENERAL (English (U.S.))
-Resource31=IDA_SCRIPT_MANAGER
-Resource32=IDD_DISCOVERY_RANGES
+Resource31=IDD_DISCOVERY_TARGETS
+Resource32=IDD_CREATE_TG
 Class29=CUserSelectDlg
-Resource33=IDA_OBJECT_BROWSER
+Resource33=IDD_REMOVE_TEMPLATE
 Class30=CUserEditor
 Resource34=IDD_DCI_PROPERTIES
 Class31=CNewUserDlg
-Resource35=IDD_CREATE_TEMPLATE
-Resource36=IDA_TRAP_EDITOR
+Resource35=IDA_LAST_VALUES
+Resource36=IDD_OBJECT_COND_GENERAL
 Class32=CUserPropDlg
 Resource37=IDD_SELECT_USER (English (U.S.))
-Resource38=IDD_DISCOVERY_GENERAL
+Resource38=IDD_CREATE_NODE
 Class33=CGroupPropDlg
-Resource39=IDD_NEW_ACTION
-Resource40=IDD_SELECT_INTERNAL_ITEM
-Resource41=IDD_SUBMAP_BKGND
+Resource39=IDA_ALARM_BROWSER
+Resource40=IDA_OBJECT_TOOLS_EDITOR
+Resource41=IDD_EDIT_RULE_COMMENT
 Resource42=IDD_MIB_BROWSER (English (U.S.))
 Class34=CPasswordChangeDlg
 Class35=CNodeSummary
@@ -99,56 +99,56 @@ Class40=CGraph
 Class41=CGraphFrame
 Class42=CDCIThresholdsPage
 Resource46=IDD_DISCOVERY_RANGES (English (U.S.))
-Resource47=IDA_NODE_POLLER
-Resource48=IDD_CP_GENERAL
+Resource47=IDD_OBJECT_NODE_GENERAL
+Resource48=IDA_EPP
 Class43=CThresholdDlg
 Resource49=IDD_EDIT_EVENT (English (U.S.))
-Resource50=IDD_CREATE_MP
+Resource50=IDD_DATA_QUERY
 Class44=CMIBBrowserDlg
 Class45=CEventPolicyEditor
 Class46=CRuleList
 Class47=CRuleHeader
 Resource51=IDD_OBJECT_IF_GENERAL (English (U.S.))
-Resource52=IDD_CREATE_CLUSTER
+Resource52=IDD_SELECT_AGENT_PARAM
 Class48=CObjectSelDlg
-Resource53=IDD_EDIT_RULE_SITUATION
-Resource54=IDD_COND_DCI_PROP
+Resource53=IDD_DCI_SCHEDULE
+Resource54=IDR_MAINFRAME
 Class49=CRuleCommentDlg
-Resource55=IDD_CHANGE_PASSWORD
+Resource55=IDD_EDIT_RULE_OPTIONS
 Class50=CEventSelDlg
-Resource56=IDD_DCI_TRANSFORM
+Resource56=IDA_GRAPH
 Resource57=IDD_COND_DCI_PROP (English (U.S.))
-Resource58=IDA_DATA_VIEW
+Resource58=IDD_DISCOVERY_RANGES
 Resource59=IDD_GROUP_PROPERTIES (English (U.S.))
 Resource60=IDD_DISCOVERY_GENERAL (English (U.S.))
 Class51=CObjectPropsPresentation
 Resource61=IDD_SET_PASSWORD (English (U.S.))
-Resource62=IDD_MANAGE_GRAPHS
+Resource62=IDD_DESKTOP_SAVE_AS
 Class52=CRuleSeverityDlg
-Resource63=IDD_GRAPH_PROP_STYLES
+Resource63=IDD_GRAPH_PROP_SETTINGS
 Class53=CRuleAlarmDlg
 Class54=CAlarmBrowser
 Resource64=IDD_CHANGE_IP (English (U.S.))
-Resource65=IDD_REQUEST_PROCESSING
+Resource65=IDD_DEFINE_GRAPH
 Resource66=IDD_DCI_THRESHOLDS (English (U.S.))
 Resource67=IDD_GRAPH_PROP_SETTINGS (English (U.S.))
 Resource68=IDD_CREATE_VPNC (English (U.S.))
 Class55=CConsolePropsGeneral
 Class56=CActionEditor
-Resource69=IDD_OBJECT_IF_GENERAL
-Resource70=IDD_SELECT_TRAP
+Resource69=IDD_CREATE_VPNC
+Resource70=IDD_EDIT_TRAP_ARG
 Class57=CNewActionDlg
-Resource71=IDD_DISCOVERY_COMMUNITIES
+Resource71=IDD_OBJECT_VPNC_GENERAL
 Class58=CEditActionDlg
-Resource72=IDD_OBJECT_COND_SCRIPT
+Resource72=IDD_EDIT_RULE_ALARM
 Class59=CActionSelDlg
-Resource73=IDD_SELECT_SITUATION
+Resource73=IDD_SAVE_AGENT_CFG
 Resource74=IDD_OBJECT_COND_SCRIPT (English (U.S.))
 Resource75=IDD_EDIT_TRAP_ARG (English (U.S.))
-Resource76=IDA_AGENT_CFG_EDITOR
+Resource76=IDD_AGENT_CONFIG
 Class60=CCreateObjectDlg
 Class61=CCreateContainerDlg
-Resource77=IDA_CERT_MANAGER
+Resource77=IDD_SELECT_MP
 Class62=CCreateNodeDlg
 Resource78=IDA_CERT_MANAGER (English (U.S.))
 Resource79=IDT_MAP (English (U.S.))
@@ -158,31 +158,31 @@ Resource81=IDD_CREATE_CLUSTER (English (U.S.))
 Class64=CPollNodeDlg
 Resource82=IDD_POLL_NODE (English (U.S.))
 Class65=CNodePoller
-Resource83=IDD_CREATE_NETSRV
-Resource84=IDD_FATAL_ERROR
+Resource83=IDA_AGENT_CONFIG_MANAGER
+Resource84=IDD_OBJECT_NODE_POLL
 Class66=CCreateTemplateDlg
 Class67=CCreateTGDlg
-Resource85=IDD_ADDR_ENTRY
-Resource86=IDD_UPGRADE
+Resource85=IDA_EVENT_EDITOR
+Resource86=IDD_SELECT_INTERNAL_ITEM
 Class68=CTrapEditor
-Resource87=IDD_OBJECT_NODE_POLL
-Resource88=IDA_SERVER_CFG_EDITOR
-Resource89=IDR_MAINFRAME
+Resource87=IDD_DISCOVERY_GENERAL
+Resource88=IDD_COND_DCI_PROP
+Resource89=IDD_OBJTOOL_OPTIONS
 Class69=CDataQueryDlg
-Resource90=IDD_OBJECT_PRESENTATION
+Resource90=IDD_ACTION_PROPERTIES
 Class70=CTrapEditDlg
 Resource91=IDD_SET_CHILD_MGMT_STATUS (English (U.S.))
 Class71=CTrapParamDlg
-Resource92=IDD_GRAPH_PROP_SETTINGS
-Resource93=IDD_LASTVAL_PROP
+Resource92=IDA_MAP_MANAGER
+Resource93=IDD_EDIT_EVENT
 Class72=CGraphPropDlg
 Class73=CColorSelector
 Class74=CPackageMgr
-Resource94=IDD_DCI_THRESHOLDS
+Resource94=IDD_SELECT_EVENT
 Resource95=IDD_IMPORT_CA_CERT (English (U.S.))
 Resource96=IDD_SUBMAP_BKGND (English (U.S.))
 Resource97=IDD_DISCOVERY_TARGETS (English (U.S.))
-Resource98=IDD_SELECT_ACTION
+Resource98=IDD_CREATE_TEMPLATE
 Resource99=IDA_NODE_POLLER (English (U.S.))
 Resource100=IDD_CREATE_MP (English (U.S.))
 Resource101=IDM_VIEW_SPECIFIC (English (U.S.))
@@ -244,7 +244,7 @@ Class102=CWaitView
 Class103=CWebBrowser
 Class104=CSyslogBrowser
 Class105=CLPPList
-Resource129=IDD_ABOUTBOX
+Resource129=IDD_OBJECT_CLUSTER_GENERAL
 Class106=CDCISchedulePage
 Resource130=IDD_FATAL_ERROR (English (U.S.))
 Class107=CObjectPropsStatus
@@ -270,113 +270,113 @@ Class119=CMapControlBox
 Resource138=IDD_MANAGE_GRAPHS (English (U.S.))
 Class120=CSubmapBkgndDlg
 Resource139=IDD_USER_PROPERTIES (English (U.S.))
-Resource140=IDD_OBJECT_RELATIONS
-Resource141=IDD_OBJECT_CAPS
-Resource142=IDA_MDI_DEFAULT
-Resource143=IDD_OBJECT_VPNC_GENERAL
-Resource144=IDA_GRAPH
-Resource145=IDD_DCI_DATA_EXPORT
-Resource146=IDD_OBJECT_NETSRV_GENERAL
-Resource147=IDD_OBJECT_COND_DATA
-Resource148=IDD_GRAPH_PROP_DATA
-Resource149=IDD_IMPORT_CA_CERT
-Resource150=IDD_GROUP_PROPERTIES
-Resource151=IDD_SELECT_MP
-Resource152=IDA_ACTION_EDITOR
-Resource153=IDD_OBJECT_GENERAL
-Resource154=IDD_SELECT_USER
-Resource155=IDD_DEFINE_GRAPH
-Resource156=IDD_MAP_LINK
-Resource157=IDD_OBJTOOL_COLUMNS
-Resource158=IDD_DISCOVERY_TARGETS
-Resource159=IDA_ALARM_BROWSER
-Resource160=IDD_ACTION_PROPERTIES
-Resource161=IDD_CREATE_NETMAP
-Resource162=IDD_EDIT_IP_SUBNET
-Resource163=IDD_EDIT_TRAP_ARG
-Resource164=IDD_MIB_BROWSER
-Resource165=IDD_EDIT_RULE_SCRIPT
-Resource166=IDD_OBJECT_NODE_GENERAL
-Resource167=IDD_CREATE_TG
-Resource168=IDD_CREATE_CONDITION
-Resource169=IDD_DCI_SCHEDULE
-Resource170=IDD_OBJTOOL_OPTIONS
-Resource171=IDD_USER_PROPERTIES
+Resource140=IDA_NODE_POLLER
+Resource141=IDD_NEW_USER
+Resource142=IDD_CHANGE_IP
+Resource143=IDD_OBJECT_GENERAL
+Resource144=IDA_DC_EDITOR
+Resource145=IDD_SELECT_TRAP
+Resource146=IDA_OBJECT_COMMENTS
+Resource147=IDD_CP_GENERAL
+Resource148=IDD_CREATE_MP
+Resource149=IDD_GRAPH_PROP_DATA
+Resource150=IDD_MAP_LINK
+Resource151=IDD_EDIT_TRAP
+Resource152=IDD_CREATE_CONDITION
+Resource153=IDD_MANAGE_GRAPHS
+Resource154=IDD_DCI_COLLECTION
+Resource155=IDD_OBJECT_RELATIONS
+Resource156=IDD_EDIT_VARIABLE
+Resource157=IDD_MIB_BROWSER
+Resource158=IDD_DCI_TRANSFORM
+Resource159=IDD_SNMP_WALK
+Resource160=IDA_NETMAP
+Resource161=IDD_NEW_OBJECT_TOOL
+Resource162=IDD_OBJECT_SECURITY
+Resource163=IDD_OBJECT_COND_SCRIPT
+Resource164=IDD_EDIT_RULE_SITUATION
+Resource165=IDD_CREATE_CONTAINER
+Resource166=IDD_CLUSTER_RESOURCE
+Resource167=IDD_SUBMAP_BKGND
+Resource168=IDD_OBJECT_PRESENTATION
+Resource169=IDD_FATAL_ERROR
+Resource170=IDD_IMPORT_CA_CERT
+Resource171=IDD_THRESHOLD
 Class121=CModuleManager
 Class122=CDesktopManager
-Resource172=IDD_DESKTOP_SAVE_AS
-Resource173=IDA_EPP
+Resource172=IDA_SITUATION_MANAGER
+Resource173=IDD_OBJTOOL_COLUMNS
 Class123=CCreateCondDlg
 Class124=CCondPropsGeneral
 Class125=CCondPropsScript
 Class126=CCondPropsData
-Resource174=IDD_EDIT_VARIABLE
+Resource174=IDD_UPGRADE
 Class127=CAddDCIDlg
-Resource175=IDD_CREATE_VPNC
+Resource175=IDD_REQUEST_PROCESSING
 Class128=CCondDCIPropDlg
-Resource176=IDA_DC_EDITOR
+Resource176=IDD_EDIT_RULE_SCRIPT
 Class129=CAgentConfigMgr
-Resource177=IDD_AGENT_CONFIG
-Resource178=IDD_OBJECT_TRUSTED_NODES
+Resource177=IDD_SELECT_ACTION
+Resource178=IDD_OBJECT_STATUS
 Class130=CAgentCfgDlg
 Class131=CObjectCommentsEditor
-Resource179=IDA_EVENT_EDITOR
+Resource179=IDD_CHANGE_PASSWORD
 Class132=CRuleScriptDlg
 Class133=CDetailsView
-Resource180=IDA_OBJECT_TOOLS_EDITOR
+Resource180=IDA_CERT_MANAGER
 Class134=CDiscoveryPropGeneral
-Resource181=IDD_EDIT_RULE_ALARM
+Resource181=IDA_OBJECT_BROWSER
 Class135=CDiscoveryPropTargets
-Resource182=IDD_SELECT_EVENT
+Resource182=IDD_CREATE_NETMAP
 Class136=CDiscoveryPropAddrList
-Resource183=IDD_CREATE_CONTAINER
+Resource183=IDA_ACTION_EDITOR
 Class138=CObjectView
 Class139=CObjectOverview
 Class140=CAlarmView
 Class141=CObjectDepView
-Resource184=IDD_OBJECT_STATUS
+Resource184=IDD_USER_PROPERTIES
 Class137=CObjectBrowser
 Class142=CCreateMPDlg
-Resource185=IDA_OBJECT_COMMENTS
+Resource185=IDD_ABOUTBOX
 Class143=CSelectMPDlg
-Resource186=IDD_OBJECT_CLUSTER_GENERAL
+Resource186=IDA_SERVER_CFG_EDITOR
 Class144=CTrapSelDlg
-Resource187=IDD_CREATE_IF_DCI
+Resource187=IDD_DCI_DATA_EXPORT
 Class145=CConsoleUpgradeDlg
-Resource188=IDD_EDIT_RULE_SEVERITY
+Resource188=IDA_MDI_DEFAULT
 Class146=CCreateClusterDlg
-Resource189=IDD_NEW_OBJECT_TOOL
+Resource189=IDD_SET_PASSWORD
 Class147=CClusterPropsGeneral
-Resource190=IDD_REMOVE_TEMPLATE
+Resource190=IDD_CREATE_IF_DCI
 Class148=CClusterPropsResources
-Resource191=IDD_SAVE_AGENT_CFG
+Resource191=IDD_SELECT_USER
 Class149=CClusterResDlg
-Resource192=IDA_AGENT_CONFIG_MANAGER
+Resource192=IDD_ADDR_ENTRY
 Class150=CClusterView
 Class151=CExtEditCtrl
-Resource193=IDD_THRESHOLD
+Resource193=IDD_SELECT_SITUATION
 Class152=CFatalErrorDlg
-Resource194=IDD_SET_CHILD_MGMT_STATUS
+Resource194=IDD_LASTVAL_PROP
 Class153=CDefineGraphDlg
-Resource195=IDD_SELECT_OBJECT
+Resource195=IDD_OBJECT_TRUSTED_NODES
 Class154=CGraphManagerDlg
-Resource196=IDD_CHANGE_IP
+Resource196=IDD_DCI_THRESHOLDS
 Class155=CGraphStylePage
 Class156=CNodePerfView
 Class157=CCertManager
-Resource197=IDA_SITUATION_MANAGER
+Resource197=IDD_OBJECT_CAPS
 Class158=CImportCertDlg
-Resource198=IDD_CREATE_NODE
+Resource198=IDA_TRAP_EDITOR
 Class159=CNodeTopologyView
 Class160=CObjectStatusBar
 Class161=CObjectTree
-Resource199=IDM_CONTEXT
+Resource199=IDM_VIEW_SPECIFIC
 Class162=CChildMgmtStatusDlg
-Resource200=IDD_EDIT_RULE_COMMENT
+Resource200=IDD_SELECT_MAP
 Class163=CCreateIfDCIDlg
 Class164=CNodeLastValuesView
 Class165=CObjectSubordinateView
-Resource201=IDD_OBJECT_COND_GENERAL
+Resource201=IDD_EDIT_RULE_SEVERITY
 Class166=CMapLinkPropDlg
 Resource202=IDD_INPUT_BOX (English (U.S.))
 Resource203=IDD_EDIT_RULE_SEVERITY (English (U.S.))
@@ -430,21 +430,21 @@ Class172=CRuleSituationDlg
 Resource245=IDD_UPGRADE (English (U.S.))
 Class173=CObjectPropsTrustedNodes
 Resource246=IDD_OBJECT_TRUSTED_NODES (English (U.S.))
-Resource247=IDD_INPUT_BOX
-Resource248=IDD_DCI_COLLECTION
-Resource249=IDD_EDIT_RULE_OPTIONS
-Resource250=IDD_DATA_QUERY
-Resource251=IDD_EDIT_TRAP
-Resource252=IDA_LAST_VALUES
-Resource253=IDD_CLUSTER_RESOURCE
-Resource254=IDD_SELECT_AGENT_PARAM
+Resource247=IDA_DATA_VIEW
+Resource248=IDD_DISCOVERY_COMMUNITIES
+Resource249=IDD_EDIT_IP_SUBNET
+Resource250=IDD_INPUT_BOX
+Resource251=IDA_AGENT_CFG_EDITOR
+Resource252=IDD_ADD_DCI
+Resource253=IDD_OBJECT_NETSRV_GENERAL
+Resource254=IDA_SCRIPT_MANAGER
 Class174=CMapSelDlg
 Class175=CMapManager
-Resource255=IDD_OBJTOOL_GENERAL
-Resource256=IDD_OBJECT_SECURITY
+Resource255=IDD_GROUP_PROPERTIES
+Resource256=IDD_GRAPH_PROP_STYLES
 Class176=CCreateNetMapDlg
 Class177=CObjectTreeCtrl
-Resource257=IDD_ADD_DCI
+Resource257=IDD_NEW_ACTION
 Class178=CObjectPropsCustomAttrs
 Class179=CSyslogParserCfg
 Resource258=IDD_OBJECT_CUSTOM_ATTRS
@@ -2968,22 +2968,23 @@ LastObject=CNewActionDlg
 [DLG:IDD_ACTION_PROPERTIES]
 Type=1
 Class=CEditActionDlg
-ControlCount=15
+ControlCount=16
 Control1=IDC_EDIT_NAME,edit,1350631552
-Control2=IDC_RADIO_EXEC,button,1342308361
+Control2=IDC_RADIO_EXEC,button,1342373897
 Control3=IDC_RADIO_REXEC,button,1342177289
 Control4=IDC_RADIO_EMAIL,button,1342177289
 Control5=IDC_RADIO_SMS,button,1342177289
-Control6=IDC_EDIT_RCPT,edit,1350631552
-Control7=IDC_EDIT_SUBJECT,edit,1350631552
-Control8=IDC_EDIT_DATA,edit,1350631552
-Control9=IDOK,button,1342242817
-Control10=IDCANCEL,button,1342242816
-Control11=IDC_STATIC,static,1342308352
-Control12=IDC_STATIC,button,1342177287
-Control13=IDC_STATIC_RCPT,static,1342308352
-Control14=IDC_STATIC_SUBJ,static,1342308352
-Control15=IDC_STATIC_DATA,static,1342308352
+Control6=IDC_RADIO_FORWARD,button,1342177289
+Control7=IDC_EDIT_RCPT,edit,1350631552
+Control8=IDC_EDIT_SUBJECT,edit,1350631552
+Control9=IDC_EDIT_DATA,edit,1350631552
+Control10=IDOK,button,1342242817
+Control11=IDCANCEL,button,1342242816
+Control12=IDC_STATIC,static,1342308352
+Control13=IDC_STATIC,button,1342177287
+Control14=IDC_STATIC_RCPT,static,1342308352
+Control15=IDC_STATIC_SUBJ,static,1342308352
+Control16=IDC_STATIC_DATA,static,1342308352
 
 [CLS:CEditActionDlg]
 Type=0
index 00de17c..fac297a 100644 (file)
@@ -1709,6 +1709,10 @@ SOURCE=.\icons\forward.ico
 # End Source File
 # Begin Source File
 
+SOURCE=.\icons\fwd_event.ico
+# End Source File
+# Begin Source File
+
 SOURCE=.\icons\go_parent.ico
 # End Source File
 # Begin Source File
index 2524237..fe20346 100644 (file)
@@ -152,6 +152,7 @@ IDI_STOP                ICON    DISCARDABLE     "icons\\stop.ico"
 IDI_SITUATION           ICON    DISCARDABLE     "icons\\situation.ico"
 IDI_INSTANCE            ICON    DISCARDABLE     "icons\\instance.ico"
 IDI_EVENT_CORRELATION   ICON    DISCARDABLE     "icons\\event_corr.ico"
+IDI_FORWARD_EVENT       ICON    DISCARDABLE     "icons\\fwd_event.ico"
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -1979,7 +1980,7 @@ BEGIN
     LTEXT           "Action name",IDC_STATIC,7,7,40,8
 END
 
-IDD_ACTION_PROPERTIES DIALOG DISCARDABLE  0, 0, 235, 188
+IDD_ACTION_PROPERTIES DIALOG DISCARDABLE  0, 0, 235, 198
 STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_CAPTION | 
     WS_SYSMENU
 CAPTION "Action Properties"
@@ -1987,23 +1988,27 @@ FONT 8, "MS Sans Serif"
 BEGIN
     EDITTEXT        IDC_EDIT_NAME,7,17,161,14,ES_AUTOHSCROLL
     CONTROL         "&Execute command on management server",IDC_RADIO_EXEC,
-                    "Button",BS_AUTORADIOBUTTON | WS_GROUP,13,45,149,10
+                    "Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,13,
+                    45,149,10
     CONTROL         "Execute action on remote &agent",IDC_RADIO_REXEC,"Button",
                     BS_AUTORADIOBUTTON,13,56,117,10
     CONTROL         "Send e-&mail",IDC_RADIO_EMAIL,"Button",
                     BS_AUTORADIOBUTTON,13,67,53,10
     CONTROL         "Send &SMS message to mobile phone",IDC_RADIO_SMS,"Button",
                     BS_AUTORADIOBUTTON,13,78,132,10
-    EDITTEXT        IDC_EDIT_RCPT,7,107,161,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_EDIT_SUBJECT,7,137,161,14,ES_AUTOHSCROLL
-    EDITTEXT        IDC_EDIT_DATA,7,167,161,14,ES_AUTOHSCROLL
+    CONTROL         "&Forward event to other NetXMS server",
+                    IDC_RADIO_FORWARD,"Button",BS_AUTORADIOBUTTON,13,89,137,
+                    10
+    EDITTEXT        IDC_EDIT_RCPT,7,117,161,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_SUBJECT,7,147,161,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_EDIT_DATA,7,177,161,14,ES_AUTOHSCROLL
     DEFPUSHBUTTON   "OK",IDOK,178,7,50,14
     PUSHBUTTON      "Cancel",IDCANCEL,178,24,50,14
     LTEXT           "Name",IDC_STATIC,7,7,20,8
-    GROUPBOX        "Type",IDC_STATIC,7,34,161,58
-    LTEXT           "Recipent address",IDC_STATIC_RCPT,7,96,160,8
-    LTEXT           "E-mail subject",IDC_STATIC_SUBJ,7,126,160,8
-    LTEXT           "Command / message text",IDC_STATIC_DATA,7,156,159,8
+    GROUPBOX        "Type",IDC_STATIC,7,34,161,69
+    LTEXT           "Recipent address",IDC_STATIC_RCPT,7,106,160,8
+    LTEXT           "E-mail subject",IDC_STATIC_SUBJ,7,136,160,8
+    LTEXT           "Command / message text",IDC_STATIC_DATA,7,166,159,8
 END
 
 IDD_SELECT_ACTION DIALOGEX 0, 0, 259, 146
@@ -3763,7 +3768,7 @@ BEGIN
         LEFTMARGIN, 7
         RIGHTMARGIN, 228
         TOPMARGIN, 7
-        BOTTOMMARGIN, 181
+        BOTTOMMARGIN, 191
     END
 
     IDD_SELECT_ACTION, DIALOG
index 054b9f0..ea5a312 100644 (file)
 #define IDA_MAP_MANAGER                 387
 #define IDD_CREATE_NETMAP               388
 #define IDD_OBJECT_CUSTOM_ATTRS         389
+#define IDI_FORWARD_EVENT               390
 #define ID_EDIT_BOX                     525
 #define IDC_STATIC_TITLE                1003
 #define IDC_STATIC_TEXT                 1004
 #define IDC_CHECK_SAVE_GS               1528
 #define IDC_CHECK_REGISTER_AGENTS       1532
 #define IDC_CHECK_ACCESS_FILES          1533
+#define IDC_RADIO_FORWARD               1536
 #define IDR_WEB_BROWSER                 8100
 #define IDR_SYSLOG_BROWSER              8101
 #define IDR_LPP_EDITOR                  8102
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_3D_CONTROLS                     1
-#define _APS_NEXT_RESOURCE_VALUE        390
+#define _APS_NEXT_RESOURCE_VALUE        391
 #define _APS_NEXT_COMMAND_VALUE         33109
-#define _APS_NEXT_CONTROL_VALUE         1536
+#define _APS_NEXT_CONTROL_VALUE         1537
 #define _APS_NEXT_SYMED_VALUE           135
 #endif
 #endif
index 621b0ef..ed2e69c 100644 (file)
@@ -297,7 +297,7 @@ static THREAD_RESULT THREAD_CALL RunCommandThread(void *pArg)
 static BOOL ForwardEvent(const TCHAR *server, Event *event)
 {
        ISC *isc;
-       DWORD addr, rcc;
+       DWORD i, addr, rcc;
 
        addr = ResolveHostName(server);
        if (addr == INADDR_NONE)
@@ -311,16 +311,32 @@ static BOOL ForwardEvent(const TCHAR *server, Event *event)
        if (rcc == ISC_ERR_SUCCESS)
        {
                CSCPMessage msg;
+               NetObj *object;
 
                msg.SetId(1);
                msg.SetCode(CMD_FORWARD_EVENT);
-               if (isc->SendMessage(&msg))
+               object = FindObjectById(event->SourceId());
+               if (object != NULL)
                {
-                       rcc = isc->WaitForRCC(1, 10000);
+                       msg.SetVariable(VID_IP_ADDRESS, object->IpAddr());
+                       msg.SetVariable(VID_EVENT_CODE, event->Code());
+                       msg.SetVariable(VID_USER_TAG, event->UserTag());
+                       msg.SetVariable(VID_NUM_ARGS, (WORD)event->GetParametersCount());
+                       for(i = 0; i < event->GetParametersCount(); i++)
+                               msg.SetVariable(VID_EVENT_ARG_BASE + i, event->GetParameter(i));
+
+                       if (isc->SendMessage(&msg))
+                       {
+                               rcc = isc->WaitForRCC(1, 10000);
+                       }
+                       else
+                       {
+                               rcc = ISC_ERR_CONNECTION_BROKEN;
+                       }
                }
                else
                {
-                       rcc = ISC_ERR_CONNECTION_BROKEN;
+                       rcc = ISC_ERR_INTERNAL_ERROR;
                }
                isc->Disconnect();
        }
index b2e0175..6da222f 100644 (file)
@@ -27,9 +27,9 @@
 // Setup event forwarding session
 //
 
-void *EF_SetupSession(CSCPMessage *request)
+BOOL EF_SetupSession(ISCSession *, CSCPMessage *request)
 {
-       return NULL;
+       return TRUE;
 }
 
 
@@ -37,7 +37,7 @@ void *EF_SetupSession(CSCPMessage *request)
 // Close event forwarding session
 //
 
-void EF_CloseSession(void *sd)
+void EF_CloseSession(ISCSession *)
 {
 }
 
@@ -46,13 +46,60 @@ void EF_CloseSession(void *sd)
 // Process event forwarding session message
 //
 
-BOOL EF_ProcessMessage(void *sd, CSCPMessage *request, CSCPMessage *response)
+BOOL EF_ProcessMessage(ISCSession *session, CSCPMessage *request, CSCPMessage *response)
 {
-       DWORD code, objectIp;
+       int i, numArgs;
+       DWORD code, id;
+       TCHAR userTag[MAX_USERTAG_LENGTH], *argList[32];
+   char format[] = "ssssssssssssssssssssssssssssssss";
+       NetObj *object;
 
        if (request->GetCode() == CMD_FORWARD_EVENT)
        {
-               code = request->GetVariableLong(VID_EVENT_CODE);
+               DbgPrintf(4, _T("Event forwarding request from %s"), IpToStr(session->GetPeerAddress(), userTag));
+               
+               id = request->GetVariableLong(VID_OBJECT_ID);
+               if (id != 0)
+                       object = FindObjectById(id);  // Object is specified explicitely
+               else
+                       object = FindNodeByIP(request->GetVariableLong(VID_IP_ADDRESS));        // Object is specified by IP address
+               
+               if (object != NULL)
+               {
+                       code = request->GetVariableLong(VID_EVENT_CODE);
+                       request->GetVariableStr(VID_USER_TAG, userTag, MAX_USERTAG_LENGTH);
+                       numArgs = request->GetVariableShort(VID_NUM_ARGS);
+                       if (numArgs > 32)
+                               numArgs = 32;
+                       for(i = 0; i < numArgs; i++)
+                               argList[i] = request->GetVariableStr(VID_EVENT_ARG_BASE + i);
+
+                       format[numArgs] = 0;
+                       if (PostEventWithTag(code, object->Id(), userTag, (numArgs > 0) ? format : NULL,
+                                            argList[0], argList[1], argList[2], argList[3],
+                                                                               argList[4], argList[5], argList[6], argList[7],
+                                                                               argList[8], argList[9], argList[10], argList[11],
+                                                                               argList[12], argList[13], argList[14], argList[15],
+                                                                               argList[16], argList[17], argList[18], argList[19],
+                                                                               argList[20], argList[21], argList[22], argList[23],
+                                                                               argList[24], argList[25], argList[26], argList[27],
+                                                                               argList[28], argList[29], argList[30], argList[31]))
+                       {
+                               response->SetVariable(VID_RCC, ISC_ERR_SUCCESS);
+                       }
+                       else
+                       {
+                               response->SetVariable(VID_RCC, ISC_ERR_OBJECT_NOT_FOUND);
+                       }
+      
+                       // Cleanup
+                       for(i = 0; i < numArgs; i++)
+                               safe_free(argList[i]);
+               }
+               else
+               {
+                       response->SetVariable(VID_RCC, ISC_ERR_OBJECT_NOT_FOUND);
+               }
        }
        else
        {
index e47bca5..3acfeb6 100644 (file)
@@ -37,9 +37,9 @@
 // Externals\r
 //\r
 \r
-void *EF_SetupSession(CSCPMessage *);\r
-void EF_CloseSession(void *);\r
-BOOL EF_ProcessMessage(void *, CSCPMessage *, CSCPMessage *);\r
+BOOL EF_SetupSession(ISCSession *, CSCPMessage *);\r
+void EF_CloseSession(ISCSession *);\r
+BOOL EF_ProcessMessage(ISCSession *, CSCPMessage *, CSCPMessage *);\r
 \r
 \r
 //\r
@@ -49,18 +49,19 @@ BOOL EF_ProcessMessage(void *, CSCPMessage *, CSCPMessage *);
 static ISC_SERVICE m_serviceList[] = \r
 {\r
        { ISC_SERVICE_EVENT_FORWARDER, _T("EventForwarder"),\r
-         _T("EnableEventForwarder"), EF_SetupSession, EF_CloseSession, EF_ProcessMessage },\r
+         _T("ReceiveForwardedEvents"), EF_SetupSession, EF_CloseSession, EF_ProcessMessage },\r
        { 0, NULL, NULL }\r
-};
-
-
+};\r
+\r
+\r
 //
 // Request processing thread
 //
 
-static THREAD_RESULT THREAD_CALL ProcessingThread(void *pArg)
-{
-   SOCKET sock = CAST_FROM_POINTER(pArg, SOCKET);
+static THREAD_RESULT THREAD_CALL ProcessingThread(void *arg)
+{\r
+       ISCSession *session = (ISCSession *)arg;
+   SOCKET sock = session->GetSocket();
    int i, err, state = ISC_STATE_INIT;
    CSCP_MESSAGE *pRawMsg, *pRawMsgOut;
    CSCP_BUFFER *pRecvBuffer;
@@ -103,8 +104,7 @@ static THREAD_RESULT THREAD_CALL ProcessingThread(void *pArg)
                                                // Check if service is enabled\r
                                                if (ConfigReadInt(m_serviceList[i].enableParameter, 0) != 0)\r
                                                {\r
-                                                       serviceData = m_serviceList[i].setupSession(pRequest);\r
-                                                       if (serviceData != NULL)\r
+                                                       if (m_serviceList[i].setupSession(session, pRequest))\r
                                                        {\r
                                                                response.SetVariable(VID_RCC, ISC_ERR_SUCCESS);\r
                                                                state = ISC_STATE_CONNECTED;\r
@@ -131,7 +131,7 @@ static THREAD_RESULT THREAD_CALL ProcessingThread(void *pArg)
                        }\r
                        else    // Established session\r
                        {\r
-                               if (m_serviceList[serviceId].processMsg(serviceData, pRequest, &response))\r
+                               if (m_serviceList[serviceId].processMsg(session, pRequest, &response))\r
                                        break;  // Service asks to close session\r
                        }\r
                }
@@ -147,13 +147,14 @@ static THREAD_RESULT THREAD_CALL ProcessingThread(void *pArg)
    }
 
        // Close_session\r
-       if (serviceData != NULL)\r
-               m_serviceList[serviceId].closeSession(serviceData);\r
+       if (state == ISC_STATE_CONNECTED)\r
+               m_serviceList[serviceId].closeSession(session);\r
 
    shutdown(sock, 2);
    closesocket(sock);
    free(pRawMsg);
-   free(pRecvBuffer);
+   free(pRecvBuffer);\r
+       delete (ISCSession *)arg;
    return THREAD_OK;
 }
 
@@ -167,7 +168,8 @@ THREAD_RESULT THREAD_CALL ISCListener(void *pArg)
    SOCKET sock, sockClient;
    struct sockaddr_in servAddr;
    int errorCount = 0;
-   socklen_t iSize;
+   socklen_t iSize;\r
+       ISCSession *session;
 
    // Create socket
    if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
@@ -223,8 +225,9 @@ THREAD_RESULT THREAD_CALL ISCListener(void *pArg)
 
       errorCount = 0;     // Reset consecutive errors counter
 
-      // Create new session structure and threads
-      ThreadCreate(ProcessingThread, 0, CAST_TO_POINTER(sockClient, void *));
+      // Create new session structure and threads\r
+               session = new ISCSession(sockClient, &servAddr);
+      ThreadCreate(ProcessingThread, 0, session);
    }
 
    closesocket(sock);
index 3222a0b..cf6c1c1 100644 (file)
@@ -651,7 +651,8 @@ retry_db_lock:
        ThreadCreate(BeaconPoller, 0, NULL);
 
        // Start inter-server communication listener
-       ThreadCreate(ISCListener, 0, NULL);
+       if (ConfigReadInt("EnableISCListener", 0))
+               ThreadCreate(ISCListener, 0, NULL);
 
        // Allow clients to connect
        ThreadCreate(ClientListener, 0, NULL);
index 053349e..e69569d 100644 (file)
@@ -4435,7 +4435,7 @@ void ClientSession::OnTrap(CSCPMessage *pRequest)
    int i, iNumArgs;
    NetObj *pObject;
    TCHAR *pszArgList[32], szUserTag[MAX_USERTAG_LENGTH] = _T("");
-   TCHAR szFormat[] = "ssssssssssssssssssssssssssssssss";
+   char szFormat[] = "ssssssssssssssssssssssssssssssss";
    BOOL bSuccess;
 
    // Prepare response message
@@ -4474,7 +4474,7 @@ void ClientSession::OnTrap(CSCPMessage *pRequest)
          
          // Cleanup
          for(i = 0; i < iNumArgs; i++)
-            free(pszArgList[i]);
+            safe_free(pszArgList[i]);
 
          msg.SetVariable(VID_RCC, bSuccess ? RCC_SUCCESS : RCC_INVALID_EVENT_CODE);
       }
index a189405..74bd73a 100644 (file)
@@ -53,10 +53,12 @@ const TCHAR LIBNXSRV_EXPORTABLE *ISCErrorCodeToText(DWORD code)
                _T("No suitable ciphers found"),
                _T("Invalid public key"),
                _T("Invalid session key"),
-               _T("Internal error")
+               _T("Internal error"),
+               _T("Object not found"),
+               _T("Failed to post event")
        };
 
-       if (code <= ISC_ERR_INTERNAL_ERROR)
+       if (code <= ISC_ERR_POST_EVENT_FAILED)
                return errorText[code];
    return _T("Unknown error code");
 }
index f56138a..bfb539f 100644 (file)
@@ -102,6 +102,36 @@ static BOOL SetPrimaryKey(const TCHAR *table, const TCHAR *key)
 }
 
 
+//
+// Upgrade from V83 to V84
+//
+
+static BOOL H_UpgradeFromV83(void)
+{
+       if (!CreateConfigParam(_T("EnableAgentRegistration"), _T("1"), 1, 0))
+               if (!g_bIgnoreErrors)
+                       return FALSE;
+
+       if (!CreateConfigParam(_T("AnonymousFileAccess"), _T("0"), 1, 0))
+               if (!g_bIgnoreErrors)
+                       return FALSE;
+
+       if (!CreateConfigParam(_T("EnableISCListener"), _T("0"), 1, 1))
+               if (!g_bIgnoreErrors)
+                       return FALSE;
+
+       if (!CreateConfigParam(_T("ReceiveForwardedEvents"), _T("0"), 1, 0))
+               if (!g_bIgnoreErrors)
+                       return FALSE;
+
+       if (!SQLQuery(_T("UPDATE config SET var_value='84' WHERE var_name='DBFormatVersion'")))
+      if (!g_bIgnoreErrors)
+         return FALSE;
+
+   return TRUE;
+}
+
+
 //
 // Upgrade from V82 to V83
 //
@@ -3696,6 +3726,7 @@ static struct
    { 80, H_UpgradeFromV80 },
    { 81, H_UpgradeFromV81 },
    { 82, H_UpgradeFromV82 },
+   { 83, H_UpgradeFromV83 },
    { 0, NULL }
 };