added custom lock components
[public/netxms.git] / src / server / include / nms_locks.h
1 /*
2 ** NetXMS - Network Management System
3 ** Copyright (C) 2003-2014 Victor Kirhenshtein
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 **
19 ** File: nms_locks.h
20 **
21 **/
22
23 #ifndef _nms_locks_h_
24 #define _nms_locks_h_
25
26
27 #define UNLOCKED ((UINT32)0xFFFFFFFF)
28
29 /**
30 * Component identifiers used for locking
31 */
32 enum LockComponents
33 {
34 CID_EPP = 0,
35 CID_USER_DB = 1,
36 CID_PACKAGE_DB = 2,
37 CID_CUSTOM_1 = 3,
38 CID_CUSTOM_2 = 4,
39 CID_CUSTOM_3 = 5,
40 CID_CUSTOM_4 = 6,
41 CID_CUSTOM_5 = 7,
42 CID_CUSTOM_6 = 8,
43 CID_CUSTOM_7 = 9,
44 CID_CUSTOM_8 = 10
45 };
46
47 /*** Functions ***/
48 #ifndef _NETXMS_DB_SCHEMA_
49
50 BOOL InitLocks(UINT32 *pdwIpAddr, TCHAR *pszInfo);
51 BOOL LockComponent(UINT32 dwId, UINT32 dwLockBy, const TCHAR *pszOwnerInfo, UINT32 *pdwCurrentOwner, TCHAR *pszCurrentOwnerInfo);
52 void UnlockComponent(UINT32 dwId);
53 void RemoveAllSessionLocks(UINT32 dwSessionId);
54 BOOL LockLPP(UINT32 dwPolicyId, UINT32 dwSessionId);
55 void UnlockLPP(UINT32 dwPolicyId, UINT32 dwSessionId);
56 void NXCORE_EXPORTABLE UnlockDB();
57
58 #endif
59
60 #endif