Minor changes
[public/netxms.git] / src / agent / core / getparam.cpp
CommitLineData
e7474978
VK
1/*
2** NetXMS multiplatform core agent
3** Copyright (C) 2003, 2004 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: getparam.cpp
20**
21**/
22
23#include "nxagentd.h"
24
25
26//
27// Externals
28//
29
30LONG H_AgentStats(char *cmd, char *arg, char *value);
31LONG H_AgentUptime(char *cmd, char *arg, char *value);
32LONG H_CRC32(char *cmd, char *arg, char *value);
33LONG H_FileSize(char *cmd, char *arg, char *value);
bb722c91 34LONG H_FileCount(char *pszCmd, char *pszArg, char *pValue);
e7474978
VK
35LONG H_MD5Hash(char *cmd, char *arg, char *value);
36LONG H_SHA1Hash(char *cmd, char *arg, char *value);
901c96c7 37LONG H_SubAgentList(char *cmd, char *arg, NETXMS_VALUES_LIST *value);
3c774461 38LONG H_ActionList(char *cmd, char *arg, NETXMS_VALUES_LIST *value);
21a2454a 39LONG H_ExternalParameter(char *pszCmd, char *pszArg, char *pValue);
d558abc4 40LONG H_PlatformName(char *cmd, char *arg, char *value);
dc0e93b4 41
901c96c7
VK
42#ifdef _WIN32
43LONG H_ArpCache(char *cmd, char *arg, NETXMS_VALUES_LIST *value);
44LONG H_InterfaceList(char *cmd, char *arg, NETXMS_VALUES_LIST *value);
c2a9af16 45LONG H_ProcessList(char *cmd, char *arg, NETXMS_VALUES_LIST *value);
dc0e93b4
VK
46LONG H_ProcCount(char *cmd, char *arg, char *value);
47LONG H_ProcCountSpecific(char *cmd, char *arg, char *value);
48LONG H_ProcInfo(char *cmd, char *arg, char *value);
49LONG H_DiskInfo(char *cmd, char *arg, char *value);
50LONG H_MemoryInfo(char *cmd, char *arg, char *value);
51LONG H_HostName(char *cmd, char *arg, char *value);
52LONG H_SystemUname(char *cmd, char *arg, char *value);
53LONG H_ThreadCount(char *cmd, char *arg, char *value);
6849d9be
VK
54LONG H_NetIPStats(char *cmd, char *arg, char *value);
55LONG H_NetInterfaceStats(char *cmd, char *arg, char *value);
38f733bb 56LONG H_ServiceState(char *cmd, char *arg, char *value);
c2a9af16 57LONG H_CPUCount(char *cmd, char *arg, char *value);
46741a75 58LONG H_PhysicalDiskInfo(char *pszParam, char *pszArg, char *pValue);
901c96c7
VK
59#endif
60
e7474978
VK
61
62//
63// Static data
64//
65
a72a1fb1 66static NETXMS_SUBAGENT_PARAM *m_pParamList = NULL;
e7474978 67static int m_iNumParams = 0;
901c96c7
VK
68static NETXMS_SUBAGENT_ENUM *m_pEnumList = NULL;
69static int m_iNumEnums = 0;
e7474978 70static DWORD m_dwTimedOutRequests = 0;
e7474978
VK
71static DWORD m_dwAuthenticationFailures = 0;
72static DWORD m_dwProcessedRequests = 0;
73static DWORD m_dwFailedRequests = 0;
74static DWORD m_dwUnsupportedRequests = 0;
75
76
77//
78// Handler for parameters which always returns string constant
79//
80
81static LONG H_StringConstant(char *cmd, char *arg, char *value)
82{
83 ret_string(value, arg);
84 return SYSINFO_RC_SUCCESS;
85}
86
87
88//
89// Handler for parameters which returns floating point value from specific variable
90//
91
92static LONG H_FloatPtr(char *cmd, char *arg, char *value)
93{
94 ret_double(value, *((double *)arg));
95 return SYSINFO_RC_SUCCESS;
96}
97
98
99//
100// Handler for parameters which returns DWORD value from specific variable
101//
102
103static LONG H_UIntPtr(char *cmd, char *arg, char *value)
104{
105 ret_uint(value, *((DWORD *)arg));
106 return SYSINFO_RC_SUCCESS;
107}
108
109
901c96c7
VK
110//
111// Handler for parameters list
112//
113
114static LONG H_ParamList(char *cmd, char *arg, NETXMS_VALUES_LIST *value)
115{
116 int i;
117
118 for(i = 0; i < m_iNumParams; i++)
a72a1fb1 119 NxAddResultString(value, m_pParamList[i].szName);
901c96c7
VK
120 return SYSINFO_RC_SUCCESS;
121}
122
123
124//
125// Handler for enums list
126//
127
128static LONG H_EnumList(char *cmd, char *arg, NETXMS_VALUES_LIST *value)
129{
130 int i;
131
132 for(i = 0; i < m_iNumEnums; i++)
133 NxAddResultString(value, m_pEnumList[i].szName);
134 return SYSINFO_RC_SUCCESS;
135}
136
137
e7474978
VK
138//
139// Standard agent's parameters
140//
141
a72a1fb1 142static NETXMS_SUBAGENT_PARAM m_stdParams[] =
e7474978 143{
dc0e93b4 144#ifdef _WIN32
a72a1fb1
VK
145 { "Disk.Free(*)", H_DiskInfo, NULL, DCI_DT_UINT64, "Free disk space on *" },
146 { "Disk.Total(*)", H_DiskInfo, NULL, DCI_DT_UINT64, "Total disk space on *" },
125c0e81 147 { "Disk.Used(*)", H_DiskInfo, NULL, DCI_DT_UINT64, "Used disk space on *" },
954e730f 148 { "Net.Interface.AdminStatus(*)", H_NetInterfaceStats, (char *)NET_IF_ADMIN_STATUS, DCI_DT_INT, "Administrative status of interface {instance}" },
be4a0185
VK
149 { "Net.Interface.BytesIn(*)", H_NetInterfaceStats, (char *)NET_IF_BYTES_IN, DCI_DT_UINT, "Number of input bytes on interface {instance}" },
150 { "Net.Interface.BytesOut(*)", H_NetInterfaceStats, (char *)NET_IF_BYTES_OUT, DCI_DT_UINT, "Number of output bytes on interface {instance}" },
a72a1fb1 151 { "Net.Interface.Description(*)", H_NetInterfaceStats, (char *)NET_IF_DESCR, DCI_DT_STRING, "" },
be4a0185
VK
152 { "Net.Interface.InErrors(*)", H_NetInterfaceStats, (char *)NET_IF_IN_ERRORS, DCI_DT_UINT, "Number of input errors on interface {instance}" },
153 { "Net.Interface.Link(*)", H_NetInterfaceStats, (char *)NET_IF_LINK, DCI_DT_INT, "Link status for interface {instance}" },
154 { "Net.Interface.OutErrors(*)", H_NetInterfaceStats, (char *)NET_IF_OUT_ERRORS, DCI_DT_UINT, "Number of output errors on interface {instance}" },
155 { "Net.Interface.PacketsIn(*)", H_NetInterfaceStats, (char *)NET_IF_PACKETS_IN, DCI_DT_UINT, "Number of input packets on interface {instance}" },
156 { "Net.Interface.PacketsOut(*)", H_NetInterfaceStats, (char *)NET_IF_PACKETS_OUT, DCI_DT_UINT, "Number of output packets on interface {instance}" },
157 { "Net.Interface.Speed(*)", H_NetInterfaceStats, (char *)NET_IF_SPEED, DCI_DT_UINT, "Speed of interface {instance}" },
a72a1fb1 158 { "Net.IP.Forwarding", H_NetIPStats, (char *)NET_IP_FORWARDING, DCI_DT_INT, "IP forwarding status" },
7d021523 159 { "PhysicalDisk.SmartAttr(*)", H_PhysicalDiskInfo, "A", DCI_DT_STRING, "" },
46741a75
VK
160 { "PhysicalDisk.SmartStatus(*)", H_PhysicalDiskInfo, "S", DCI_DT_INT, "Status of hard disk {instance} reported by SMART" },
161 { "PhysicalDisk.Temperature(*)", H_PhysicalDiskInfo, "T", DCI_DT_INT, "Temperature of hard disk {instance}" },
a72a1fb1
VK
162 { "Process.Count(*)", H_ProcCountSpecific, NULL, DCI_DT_UINT, "" },
163 { "Process.GdiObj(*)", H_ProcInfo, (char *)PROCINFO_GDI_OBJ, DCI_DT_UINT64, "" },
164 { "Process.IO.OtherB(*)", H_ProcInfo, (char *)PROCINFO_IO_OTHER_B, DCI_DT_UINT64, "" },
165 { "Process.IO.OtherOp(*)", H_ProcInfo, (char *)PROCINFO_IO_OTHER_OP, DCI_DT_UINT64, "" },
166 { "Process.IO.ReadB(*)", H_ProcInfo, (char *)PROCINFO_IO_READ_B, DCI_DT_UINT64, "" },
167 { "Process.IO.ReadOp(*)", H_ProcInfo, (char *)PROCINFO_IO_READ_OP, DCI_DT_UINT64, "" },
168 { "Process.IO.WriteB(*)", H_ProcInfo, (char *)PROCINFO_IO_WRITE_B, DCI_DT_UINT64, "" },
169 { "Process.IO.WriteOp(*)", H_ProcInfo, (char *)PROCINFO_IO_WRITE_OP, DCI_DT_UINT64, "" },
170 { "Process.KernelTime(*)", H_ProcInfo, (char *)PROCINFO_KTIME, DCI_DT_UINT64, "" },
171 { "Process.PageFaults(*)", H_ProcInfo, (char *)PROCINFO_PF, DCI_DT_UINT64, "" },
172 { "Process.UserObj(*)", H_ProcInfo, (char *)PROCINFO_USER_OBJ, DCI_DT_UINT64, "" },
173 { "Process.UserTime(*)", H_ProcInfo, (char *)PROCINFO_UTIME, DCI_DT_UINT64, "" },
174 { "Process.VMSize(*)", H_ProcInfo, (char *)PROCINFO_VMSIZE, DCI_DT_UINT64, "" },
175 { "Process.WkSet(*)", H_ProcInfo, (char *)PROCINFO_WKSET, DCI_DT_UINT64, "" },
176 { "System.CPU.Count", H_CPUCount, NULL, DCI_DT_UINT, "Number of CPU in the system" },
177 { "System.Hostname", H_HostName, NULL, DCI_DT_STRING, "Host name" },
178 { "System.Memory.Physical.Free", H_MemoryInfo, (char *)MEMINFO_PHYSICAL_FREE, DCI_DT_UINT64, "Free physical memory" },
179 { "System.Memory.Physical.Total", H_MemoryInfo, (char *)MEMINFO_PHYSICAL_TOTAL, DCI_DT_UINT64, "Total amount of physical memory" },
180 { "System.Memory.Physical.Used", H_MemoryInfo, (char *)MEMINFO_PHYSICAL_USED, DCI_DT_UINT64, "Used physical memory" },
181 { "System.Memory.Swap.Free", H_MemoryInfo, (char *)MEMINFO_SWAP_FREE, DCI_DT_UINT64, "Free swap space" },
182 { "System.Memory.Swap.Total", H_MemoryInfo, (char *)MEMINFO_SWAP_TOTAL, DCI_DT_UINT64, "Total amount of swap space" },
183 { "System.Memory.Swap.Used", H_MemoryInfo, (char *)MEMINFO_SWAP_USED, DCI_DT_UINT64, "Used swap space" },
184 { "System.Memory.Virtual.Free", H_MemoryInfo, (char *)MEMINFO_VIRTUAL_FREE, DCI_DT_UINT64, "Free virtual memory" },
185 { "System.Memory.Virtual.Total", H_MemoryInfo, (char *)MEMINFO_VIRTUAL_TOTAL, DCI_DT_UINT64, "Total amount of virtual memory" },
186 { "System.Memory.Virtual.Used", H_MemoryInfo, (char *)MEMINFO_VIRTUAL_USED, DCI_DT_UINT64, "Used virtual memory" },
187 { "System.ProcessCount", H_ProcCount, NULL, DCI_DT_INT, "Total number of processes" },
18f8db9b 188 { "System.ServiceState(*)", H_ServiceState, NULL, DCI_DT_INT, "State of {instance} service" },
a72a1fb1
VK
189 { "System.ThreadCount", H_ThreadCount, NULL, DCI_DT_INT, "Total number of threads" },
190 { "System.Uname", H_SystemUname, NULL, DCI_DT_STRING, "System uname" },
dc0e93b4 191#endif
a72a1fb1
VK
192 { "Agent.AcceptedConnections", H_UIntPtr, (char *)&g_dwAcceptedConnections, DCI_DT_UINT, "" },
193 { "Agent.AcceptErrors", H_UIntPtr, (char *)&g_dwAcceptErrors, DCI_DT_UINT, "" },
194 { "Agent.AuthenticationFailures", H_UIntPtr, (char *)&m_dwAuthenticationFailures, DCI_DT_UINT, "" },
195 { "Agent.FailedRequests", H_UIntPtr, (char *)&m_dwFailedRequests, DCI_DT_UINT, "" },
196 { "Agent.ProcessedRequests", H_UIntPtr, (char *)&m_dwProcessedRequests, DCI_DT_UINT, "" },
197 { "Agent.RejectedConnections", H_UIntPtr, (char *)&g_dwRejectedConnections, DCI_DT_UINT, "" },
198 { "Agent.SourcePackageSupport", H_StringConstant, "0", DCI_DT_INT, "" },
199 { "Agent.TimedOutRequests", H_UIntPtr, (char *)&m_dwTimedOutRequests, DCI_DT_UINT, "" },
200 { "Agent.UnsupportedRequests", H_UIntPtr, (char *)&m_dwUnsupportedRequests, DCI_DT_UINT, "" },
201 { "Agent.Uptime", H_AgentUptime, NULL, DCI_DT_UINT, "Agent's uptime" },
202 { "Agent.Version", H_StringConstant, AGENT_VERSION_STRING, DCI_DT_STRING, "Agent's version" },
203 { "File.Count(*)", H_FileCount, NULL, DCI_DT_UINT, "" },
e3846581
VK
204 { "File.Hash.CRC32(*)", H_CRC32, NULL, DCI_DT_UINT, "CRC32 checksum of *" },
205 { "File.Hash.MD5(*)", H_MD5Hash, NULL, DCI_DT_STRING, "MD5 has of *" },
206 { "File.Hash.SHA1(*)", H_SHA1Hash, NULL, DCI_DT_STRING, "SHA1 hash of *" },
a72a1fb1
VK
207 { "File.Size(*)", H_FileSize, NULL, DCI_DT_UINT64, "" },
208 { "System.PlatformName", H_PlatformName, NULL, DCI_DT_STRING, "" }
e7474978
VK
209};
210
211
901c96c7
VK
212//
213// Standard agent's enumerations
214//
215
216static NETXMS_SUBAGENT_ENUM m_stdEnums[] =
217{
218#ifdef _WIN32
6849d9be
VK
219 { "Net.ArpCache", H_ArpCache, NULL },
220 { "Net.InterfaceList", H_InterfaceList, NULL },
c2a9af16 221 { "System.ProcessList", H_ProcessList, NULL },
901c96c7 222#endif
c2a9af16 223 { "Agent.ActionList", H_ActionList, NULL },
6849d9be
VK
224 { "Agent.SubAgentList", H_SubAgentList, NULL },
225 { "Agent.SupportedEnums", H_EnumList, NULL },
226 { "Agent.SupportedParameters", H_ParamList, NULL }
901c96c7
VK
227};
228
229
e7474978
VK
230//
231// Initialize dynamic parameters list from default static list
232//
233
234BOOL InitParameterList(void)
235{
901c96c7 236 if ((m_pParamList != NULL) || (m_pEnumList != NULL))
e7474978
VK
237 return FALSE;
238
a72a1fb1
VK
239 m_iNumParams = sizeof(m_stdParams) / sizeof(NETXMS_SUBAGENT_PARAM);
240 m_pParamList = (NETXMS_SUBAGENT_PARAM *)malloc(sizeof(NETXMS_SUBAGENT_PARAM) * m_iNumParams);
e7474978
VK
241 if (m_pParamList == NULL)
242 return FALSE;
a72a1fb1 243 memcpy(m_pParamList, m_stdParams, sizeof(NETXMS_SUBAGENT_PARAM) * m_iNumParams);
901c96c7
VK
244
245 m_iNumEnums = sizeof(m_stdEnums) / sizeof(NETXMS_SUBAGENT_ENUM);
246 m_pEnumList = (NETXMS_SUBAGENT_ENUM *)malloc(sizeof(NETXMS_SUBAGENT_ENUM) * m_iNumEnums);
247 if (m_pEnumList == NULL)
248 return FALSE;
249 memcpy(m_pEnumList, m_stdEnums, sizeof(NETXMS_SUBAGENT_ENUM) * m_iNumEnums);
250
e7474978
VK
251 return TRUE;
252}
253
254
255//
256// Add parameter to list
257//
258
125c0e81
VK
259void AddParameter(char *pszName, LONG (* fpHandler)(char *,char *,char *), char *pArg,
260 int iDataType, char *pszDescription)
e7474978 261{
19acf449
VK
262 int i;
263
264 // Search for existing parameter
265 for(i = 0; i < m_iNumParams; i++)
a72a1fb1 266 if (!stricmp(m_pParamList[i].szName, pszName))
19acf449
VK
267 break;
268 if (i < m_iNumParams)
269 {
125c0e81 270 // Replace existing handler and attributes
a72a1fb1 271 m_pParamList[i].fpHandler = fpHandler;
125c0e81
VK
272 m_pParamList[i].iDataType = iDataType;
273 strncpy(m_pParamList[i].szDescription, pszDescription, MAX_DB_STRING);
19acf449
VK
274
275 // If we are replacing System.PlatformName, add pointer to
276 // platform suffix as argument, otherwise, use supplied pArg
277 if (!strcmp(pszName, "System.PlatformName"))
278 {
a72a1fb1 279 m_pParamList[i].pArg = g_szPlatformSuffix;
19acf449
VK
280 }
281 else
282 {
a72a1fb1 283 m_pParamList[i].pArg = pArg;
19acf449
VK
284 }
285 }
286 else
287 {
288 // Add new parameter
a72a1fb1
VK
289 m_pParamList = (NETXMS_SUBAGENT_PARAM *)realloc(m_pParamList, sizeof(NETXMS_SUBAGENT_PARAM) * (m_iNumParams + 1));
290 strncpy(m_pParamList[m_iNumParams].szName, pszName, MAX_PARAM_NAME - 1);
291 m_pParamList[m_iNumParams].fpHandler = fpHandler;
292 m_pParamList[m_iNumParams].pArg = pArg;
125c0e81
VK
293 m_pParamList[m_iNumParams].iDataType = iDataType;
294 strncpy(m_pParamList[m_iNumParams].szDescription, pszDescription, MAX_DB_STRING);
19acf449
VK
295 m_iNumParams++;
296 }
e7474978
VK
297}
298
299
962b3915
VK
300//
301// Add enum to list
302//
303
19acf449 304void AddEnum(char *pszName, LONG (* fpHandler)(char *,char *,NETXMS_VALUES_LIST *), char *pArg)
962b3915 305{
19acf449
VK
306 int i;
307
308 // Search for existing enum
309 for(i = 0; i < m_iNumEnums; i++)
310 if (!stricmp(m_pEnumList[i].szName, pszName))
311 break;
312 if (i < m_iNumEnums)
313 {
314 // Replace existing handler and arg
315 m_pEnumList[i].fpHandler = fpHandler;
316 m_pEnumList[i].pArg = pArg;
317 }
318 else
319 {
320 // Add new enum
321 m_pEnumList = (NETXMS_SUBAGENT_ENUM *)realloc(m_pEnumList, sizeof(NETXMS_SUBAGENT_ENUM) * (m_iNumEnums + 1));
322 strncpy(m_pEnumList[m_iNumEnums].szName, pszName, MAX_PARAM_NAME - 1);
323 m_pEnumList[m_iNumEnums].fpHandler = fpHandler;
324 m_pEnumList[m_iNumEnums].pArg = pArg;
325 m_iNumEnums++;
326 }
962b3915
VK
327}
328
329
21a2454a
VK
330//
331// Add external parameter
332//
333
334BOOL AddExternalParameter(char *pszCfgLine)
335{
336 char *pszCmdLine;
337
338 pszCmdLine = strchr(pszCfgLine, ':');
339 if (pszCmdLine == NULL)
340 return FALSE;
341
342 *pszCmdLine = 0;
343 pszCmdLine++;
344 StrStrip(pszCfgLine);
345 StrStrip(pszCmdLine);
346 if ((*pszCfgLine == 0) || (*pszCmdLine == 0))
347 return FALSE;
348
125c0e81 349 AddParameter(pszCfgLine, H_ExternalParameter, strdup(pszCmdLine), DCI_DT_STRING, "");
21a2454a
VK
350 return TRUE;
351}
352
353
e7474978
VK
354//
355// Get parameter's value
356//
357
7c205c0c 358DWORD GetParameterValue(char *pszParam, char *pszValue)
e7474978
VK
359{
360 int i, rc;
7c205c0c 361 DWORD dwErrorCode;
e7474978 362
6082bd00 363 DebugPrintf("Requesting parameter \"%s\"", pszParam);
e7474978 364 for(i = 0; i < m_iNumParams; i++)
a72a1fb1 365 if (MatchString(m_pParamList[i].szName, pszParam, FALSE))
e7474978 366 {
a72a1fb1 367 rc = m_pParamList[i].fpHandler(pszParam, m_pParamList[i].pArg, pszValue);
e7474978
VK
368 switch(rc)
369 {
370 case SYSINFO_RC_SUCCESS:
7c205c0c 371 dwErrorCode = ERR_SUCCESS;
e7474978
VK
372 m_dwProcessedRequests++;
373 break;
374 case SYSINFO_RC_ERROR:
7c205c0c 375 dwErrorCode = ERR_INTERNAL_ERROR;
e7474978
VK
376 m_dwFailedRequests++;
377 break;
378 case SYSINFO_RC_UNSUPPORTED:
7c205c0c 379 dwErrorCode = ERR_UNKNOWN_PARAMETER;
e7474978
VK
380 m_dwUnsupportedRequests++;
381 break;
382 default:
7c205c0c
VK
383 WriteLog(MSG_UNEXPECTED_IRC, EVENTLOG_ERROR_TYPE, "ds", rc, pszParam);
384 dwErrorCode = ERR_INTERNAL_ERROR;
e7474978
VK
385 m_dwFailedRequests++;
386 break;
387 }
388 break;
389 }
390 if (i == m_iNumParams)
391 {
7c205c0c 392 dwErrorCode = ERR_UNKNOWN_PARAMETER;
e7474978
VK
393 m_dwUnsupportedRequests++;
394 }
7c205c0c 395 return dwErrorCode;
e7474978 396}
901c96c7
VK
397
398
399//
400// Get parameter's value
401//
402
403DWORD GetEnumValue(char *pszParam, NETXMS_VALUES_LIST *pValue)
404{
405 int i, rc;
406 DWORD dwErrorCode;
407
6082bd00 408 DebugPrintf("Requesting enum \"%s\"", pszParam);
901c96c7
VK
409 for(i = 0; i < m_iNumEnums; i++)
410 if (MatchString(m_pEnumList[i].szName, pszParam, FALSE))
411 {
412 rc = m_pEnumList[i].fpHandler(pszParam, m_pEnumList[i].pArg, pValue);
413 switch(rc)
414 {
415 case SYSINFO_RC_SUCCESS:
416 dwErrorCode = ERR_SUCCESS;
417 m_dwProcessedRequests++;
418 break;
419 case SYSINFO_RC_ERROR:
420 dwErrorCode = ERR_INTERNAL_ERROR;
421 m_dwFailedRequests++;
422 break;
423 case SYSINFO_RC_UNSUPPORTED:
424 dwErrorCode = ERR_UNKNOWN_PARAMETER;
425 m_dwUnsupportedRequests++;
426 break;
427 default:
428 WriteLog(MSG_UNEXPECTED_IRC, EVENTLOG_ERROR_TYPE, "ds", rc, pszParam);
429 dwErrorCode = ERR_INTERNAL_ERROR;
430 m_dwFailedRequests++;
431 break;
432 }
433 break;
434 }
435 if (i == m_iNumEnums)
436 {
437 dwErrorCode = ERR_UNKNOWN_PARAMETER;
438 m_dwUnsupportedRequests++;
439 }
440 return dwErrorCode;
441}
a72a1fb1
VK
442
443
444//
445// Put complete list of supported parameters into CSCP message
446//
447
448void GetParameterList(CSCPMessage *pMsg)
449{
450 int i;
451 DWORD dwId;
452
453 pMsg->SetVariable(VID_NUM_PARAMETERS, (DWORD)m_iNumParams);
454 for(i = 0, dwId = VID_PARAM_LIST_BASE; i < m_iNumParams; i++)
455 {
456 pMsg->SetVariable(dwId++, m_pParamList[i].szName);
457 pMsg->SetVariable(dwId++, m_pParamList[i].szDescription);
458 pMsg->SetVariable(dwId++, (WORD)m_pParamList[i].iDataType);
459 }
460}