added custom lock components
authorVictor Kirhenshtein <victor@netxms.org>
Sat, 24 May 2014 14:58:23 +0000 (17:58 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Sat, 24 May 2014 14:58:23 +0000 (17:58 +0300)
src/server/core/locks.cpp
src/server/core/nxcore.vcproj
src/server/include/nms_core.h
src/server/include/nms_locks.h

index f367297..cf5bd64 100644 (file)
 #define MAX_OWNER_INFO     256
 #define NUMBER_OF_LOCKS    7
 
-
-//
-// Lock structure
-//
-
+/**
+ * Lock information structure
+ */
 struct LOCK_INFO
 {
    UINT32 dwLockStatus;
@@ -59,12 +57,10 @@ static LOCK_INFO m_locks[NUMBER_OF_LOCKS] =
    { UNLOCKED, _T("deprecated: Object Tools Configuration"), _T("") }
 };
 
-
-//
-// Lock entire database and clear all other locks
-// Will return FALSE if someone already locked database
-//
-
+/**
+ * Lock entire database and clear all other locks
+ * Will return FALSE if someone already locked database
+ */
 BOOL InitLocks(UINT32 *pdwIpAddr, TCHAR *pszInfo)
 {
    BOOL bSuccess = FALSE;
@@ -98,11 +94,9 @@ BOOL InitLocks(UINT32 *pdwIpAddr, TCHAR *pszInfo)
    return bSuccess;
 }
 
-
-//
-// Unlock database
-//
-
+/**
+ * Unlock database
+ */
 void NXCORE_EXPORTABLE UnlockDB()
 {
    ConfigWriteStr(_T("DBLockStatus"), _T("UNLOCKED"), FALSE);
@@ -110,16 +104,13 @@ void NXCORE_EXPORTABLE UnlockDB()
    ConfigWriteULong(_T("DBLockPID"), 0, FALSE);
 }
 
-
-//
-// Lock component
-// Function will try to lock specified component. On success, will return TRUE.
-// On failure, will return FALSE and pdwCurrentOwner will be set to the value of lock_status
-// field, and pszCurrentOwnerInfo will be filled with the value of  owner_info field.
-//
-
-BOOL LockComponent(UINT32 dwId, UINT32 dwLockBy, const TCHAR *pszOwnerInfo, 
-                   UINT32 *pdwCurrentOwner, TCHAR *pszCurrentOwnerInfo)
+/**
+ * Lock component
+ * Function will try to lock specified component. On success, will return TRUE.
+ * On failure, will return FALSE and pdwCurrentOwner will be set to the value of lock_status
+ * field, and pszCurrentOwnerInfo will be filled with the value of  owner_info field.
+ */
+BOOL LockComponent(UINT32 dwId, UINT32 dwLockBy, const TCHAR *pszOwnerInfo, UINT32 *pdwCurrentOwner, TCHAR *pszCurrentOwnerInfo)
 {
    TCHAR szBuffer[256];
    BOOL bSuccess = FALSE;
@@ -160,11 +151,9 @@ BOOL LockComponent(UINT32 dwId, UINT32 dwLockBy, const TCHAR *pszOwnerInfo,
    return bSuccess;
 }
 
-
-//
-// Unlock component
-//
-
+/**
+ * Unlock component
+ */
 void UnlockComponent(UINT32 dwId)
 {
    MutexLock(m_hMutexLockerAccess);
@@ -174,11 +163,9 @@ void UnlockComponent(UINT32 dwId)
    DbgPrintf(5, _T("*Locks* Component \"%s\" unlocked"), m_locks[dwId].pszName);
 }
 
-
-//
-// Unlock all locks for specific session
-//
-
+/**
+ * Unlock all locks for specific session
+ */
 void RemoveAllSessionLocks(UINT32 dwSessionId)
 {
    UINT32 i;
index 6dfe323..8592caf 100644 (file)
                                >
                        </File>
                        <File
+                               RelativePath=".\ldap.cpp"
+                               >
+                       </File>
+                       <File
                                RelativePath=".\lldp.cpp"
                                >
                        </File>
index 5eeb8da..5b4faa0 100644 (file)
@@ -179,6 +179,14 @@ typedef void * HSNMPSESSION;
 #define CSF_AUTHENTICATED        ((UINT32)0x00000080)
 #define CSF_RECEIVING_MAP_DATA   ((UINT32)0x00000200)
 #define CSF_SYNC_OBJECT_COMMENTS ((UINT32)0x00000400)
+#define CSF_CUSTOM_LOCK_1        ((UINT32)0x01000000)
+#define CSF_CUSTOM_LOCK_2        ((UINT32)0x02000000)
+#define CSF_CUSTOM_LOCK_3        ((UINT32)0x04000000)
+#define CSF_CUSTOM_LOCK_4        ((UINT32)0x08000000)
+#define CSF_CUSTOM_LOCK_5        ((UINT32)0x10000000)
+#define CSF_CUSTOM_LOCK_6        ((UINT32)0x20000000)
+#define CSF_CUSTOM_LOCK_7        ((UINT32)0x40000000)
+#define CSF_CUSTOM_LOCK_8        ((UINT32)0x80000000)
 
 /**
  * Client session states
index e3682d7..7db5370 100644 (file)
@@ -1,6 +1,6 @@
 /* 
 ** NetXMS - Network Management System
-** Copyright (C) 2003, 2004 Victor Kirhenshtein
+** Copyright (C) 2003-2014 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
 ** along with this program; if not, write to the Free Software
 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 **
-** $module: nms_locks.h
+** File: nms_locks.h
 **
 **/
 
 
 #define UNLOCKED           ((UINT32)0xFFFFFFFF)
 
-
-//
-// Component identifiers used for locking
-//
-
-#define CID_EPP               0
-#define CID_USER_DB           1
-//deprecated: #define CID_EVENT_DB          2
-//deprecated: #define CID_ACTION_DB         3
-//deprecated: #define CID_TRAP_CFG          4
-#define CID_PACKAGE_DB        5
-//deprecated: #define CID_OBJECT_TOOLS      6
-
-
-//
-// Functions
-//
-
+/**
+ * Component identifiers used for locking
+ */
+enum LockComponents
+{
+   CID_EPP = 0,
+   CID_USER_DB = 1,
+   CID_PACKAGE_DB = 2,
+   CID_CUSTOM_1 = 3,
+   CID_CUSTOM_2 = 4,
+   CID_CUSTOM_3 = 5,
+   CID_CUSTOM_4 = 6,
+   CID_CUSTOM_5 = 7,
+   CID_CUSTOM_6 = 8,
+   CID_CUSTOM_7 = 9,
+   CID_CUSTOM_8 = 10
+};
+
+/*** Functions ***/
 #ifndef _NETXMS_DB_SCHEMA_
 
 BOOL InitLocks(UINT32 *pdwIpAddr, TCHAR *pszInfo);