- Added header file nms_util.h which defines interface to utility library [Victor]
[public/netxms.git] / include / nms_util.h
CommitLineData
e9246d26
VK
1/*
2** Project X - Network Management System
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
29
30//
31// Class for holding CSCP messages
32//
33
34class EXPORTABLE CSCPMessage
35{
36private:
37 WORD m_wCode;
38 DWORD m_dwId;
39 DWORD m_dwNumVar; // Number of variables
40 CSCP_DF **m_ppVarList; // List of variables
41
42 void Set(char *szName, BYTE bType, void *pValue);
43 void *Get(char *szName, BYTE bType);
44 DWORD FindVariable(char *szName);
45
46public:
47 CSCPMessage();
48 CSCPMessage(CSCP_MESSAGE *pMsg);
49 ~CSCPMessage();
50
51 CSCP_MESSAGE *CreateMessage(void);
52
53 WORD GetCode(void) { return m_wCode; }
54 void SetCode(WORD wCode) { m_wCode = wCode; }
55
56 DWORD GetId(void) { return m_dwId; }
57 void SetId(DWORD dwId) { m_dwId = dwId; }
58
59 void SetVariable(char *szName, DWORD dwValue) { Set(szName, DT_INTEGER, &dwValue); }
60 void SetVariable(char *szName, QWORD qwValue) { Set(szName, DT_INT64, &qwValue); }
61 void SetVariable(char *szName, char *szValue) { Set(szName, DT_STRING, szValue); }
62
63 DWORD GetVariableLong(char *szName);
64 QWORD GetVariableInt64(char *szName);
65 char *GetVariableStr(char *szName);
66};
67
68
69//
70// Functions
71//
72
73extern "C"
74{
75 void EXPORTABLE LibUtilDestroyObject(void *pObject);
76}
77
78#endif /* _nms_util_h_ */