added quote character escape in function AgentGetParameterArg
[public/netxms.git] / src / agent / subagents / ssh / main.cpp
1 /*
2 ** NetXMS SSH subagent
3 ** Copyright (C) 2004-2016 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: main.cpp
20 **
21 **/
22
23 #include "ssh_subagent.h"
24
25 /**
26 * Configuration file template
27 */
28 static NX_CFG_TEMPLATE m_cfgTemplate[] =
29 {
30 { _T(""), CT_END_OF_LIST, 0, 0, 0, 0, NULL }
31 };
32
33 /**
34 * Subagent initialization
35 */
36 static BOOL SubagentInit(Config *config)
37 {
38 ssh_init();
39 nxlog_debug(2, _T("SSH: using libssh version %hs"), ssh_version(0));
40 return TRUE;
41 }
42
43 /**
44 * Called by master agent at unload
45 */
46 static void SubagentShutdown()
47 {
48 }
49
50 /**
51 * Supported parameters
52 */
53 static NETXMS_SUBAGENT_PARAM m_parameters[] =
54 {
55 { _T("SSH.Command(*)"), H_SSHCommand, NULL, DCI_DT_STRING, _T("Result of command execution") },
56 };
57
58 /**
59 * Supported lists
60 */
61 static NETXMS_SUBAGENT_LIST m_lists[] =
62 {
63 { _T("SSH.Command(*)"), H_SSHCommandList, NULL, _T("Result of command execution") },
64 };
65
66 /**
67 * Subagent information
68 */
69 static NETXMS_SUBAGENT_INFO m_info =
70 {
71 NETXMS_SUBAGENT_INFO_MAGIC,
72 _T("SSH"), NETXMS_VERSION_STRING,
73 SubagentInit, SubagentShutdown, NULL,
74 sizeof(m_parameters) / sizeof(NETXMS_SUBAGENT_PARAM),
75 m_parameters,
76 sizeof(m_lists) / sizeof(NETXMS_SUBAGENT_LIST),
77 m_lists,
78 0, NULL, // tables
79 0, NULL, // actions
80 0, NULL // push parameters
81 };
82
83 /**
84 * Entry point for NetXMS agent
85 */
86 DECLARE_SUBAGENT_ENTRY_POINT(SSH)
87 {
88 *ppInfo = &m_info;
89 return TRUE;
90 }
91
92 #ifdef _WIN32
93
94 /**
95 * DLL entry point
96 */
97 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
98 {
99 if (dwReason == DLL_PROCESS_ATTACH)
100 DisableThreadLibraryCalls(hInstance);
101 return TRUE;
102 }
103
104 #endif