- Added initial code for managing users [Victor]
[public/netxms.git] / include / nms_util.h
CommitLineData
e9246d26 1/*
7ac71e60 2** NetXMS - Network Management System
e9246d26
VK
3** Copyright (C) 2003 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** $module: nms_util.h
20**
21**/
22
23#ifndef _nms_util_h_
24#define _nms_util_h_
25
26#include <nms_common.h>
27#include <nms_cscp.h>
28
f44f6a97
VK
29#define INVALID_INDEX 0xFFFFFFFF
30
e9246d26
VK
31
32//
33// Class for holding CSCP messages
34//
35
36class EXPORTABLE CSCPMessage
37{
38private:
39 WORD m_wCode;
40 DWORD m_dwId;
41 DWORD m_dwNumVar; // Number of variables
42 CSCP_DF **m_ppVarList; // List of variables
43
44 void Set(char *szName, BYTE bType, void *pValue);
45 void *Get(char *szName, BYTE bType);
46 DWORD FindVariable(char *szName);
47
48public:
49 CSCPMessage();
50 CSCPMessage(CSCP_MESSAGE *pMsg);
51 ~CSCPMessage();
52
53 CSCP_MESSAGE *CreateMessage(void);
54
55 WORD GetCode(void) { return m_wCode; }
56 void SetCode(WORD wCode) { m_wCode = wCode; }
57
58 DWORD GetId(void) { return m_dwId; }
59 void SetId(DWORD dwId) { m_dwId = dwId; }
60
f44f6a97
VK
61 BOOL IsVariableExist(char *szName) { return (FindVariable(szName) != INVALID_INDEX) ? TRUE : FALSE; }
62
e9246d26
VK
63 void SetVariable(char *szName, DWORD dwValue) { Set(szName, DT_INTEGER, &dwValue); }
64 void SetVariable(char *szName, QWORD qwValue) { Set(szName, DT_INT64, &qwValue); }
65 void SetVariable(char *szName, char *szValue) { Set(szName, DT_STRING, szValue); }
66
67 DWORD GetVariableLong(char *szName);
68 QWORD GetVariableInt64(char *szName);
69 char *GetVariableStr(char *szName);
70};
71
72
73//
74// Functions
75//
76
77extern "C"
78{
79 void EXPORTABLE LibUtilDestroyObject(void *pObject);
80}
81
82#endif /* _nms_util_h_ */