directory structure change
authorAlex Kirhenshtein <alk@netxms.org>
Fri, 27 Jan 2012 16:21:50 +0000 (16:21 +0000)
committerAlex Kirhenshtein <alk@netxms.org>
Fri, 27 Jan 2012 16:21:50 +0000 (16:21 +0000)
.gitattributes
sdk/samples/C/samples.sln [new file with mode: 0644]
sdk/samples/C/subagent/sample-subagent.cpp [new file with mode: 0644]
sdk/samples/C/subagent/sample-subagent.vcproj [new file with mode: 0644]

index 1e90626..fc80746 100644 (file)
@@ -117,6 +117,7 @@ sdk/openssl/lib/x64/libeay32.lib -text
 sdk/openssl/lib/x64/ssleay32.lib -text
 sdk/openssl/lib/x86/libeay32.lib -text
 sdk/openssl/lib/x86/ssleay32.lib -text
+sdk/samples/C/subagent/sample-subagent.vcproj -text
 sdk/samples/subagent/sample-subagent.vcproj -text
 src/agent/core/epp.cpp -text
 src/agent/core/nxagentd-unicode.vcproj -text
diff --git a/sdk/samples/C/samples.sln b/sdk/samples/C/samples.sln
new file mode 100644 (file)
index 0000000..8f2dd3e
--- /dev/null
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample-subagent", "subagent\sample-subagent.vcproj", "{94F0ABB3-5B3E-483B-8B3B-E9E4D3BAC65A}"
+EndProject
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|Win32 = Debug|Win32
+               Debug|x64 = Debug|x64
+               Release|Win32 = Release|Win32
+               Release|x64 = Release|x64
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {94F0ABB3-5B3E-483B-8B3B-E9E4D3BAC65A}.Debug|Win32.ActiveCfg = Debug|Win32
+               {94F0ABB3-5B3E-483B-8B3B-E9E4D3BAC65A}.Debug|Win32.Build.0 = Debug|Win32
+               {94F0ABB3-5B3E-483B-8B3B-E9E4D3BAC65A}.Debug|x64.ActiveCfg = Debug|x64
+               {94F0ABB3-5B3E-483B-8B3B-E9E4D3BAC65A}.Debug|x64.Build.0 = Debug|x64
+               {94F0ABB3-5B3E-483B-8B3B-E9E4D3BAC65A}.Release|Win32.ActiveCfg = Release|Win32
+               {94F0ABB3-5B3E-483B-8B3B-E9E4D3BAC65A}.Release|Win32.Build.0 = Release|Win32
+               {94F0ABB3-5B3E-483B-8B3B-E9E4D3BAC65A}.Release|x64.ActiveCfg = Release|x64
+               {94F0ABB3-5B3E-483B-8B3B-E9E4D3BAC65A}.Release|x64.Build.0 = Release|x64
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal
diff --git a/sdk/samples/C/subagent/sample-subagent.cpp b/sdk/samples/C/subagent/sample-subagent.cpp
new file mode 100644 (file)
index 0000000..2b8fa57
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+** Sample NetXMS subagent
+** Copyright (c) 2011 RadenSolutions
+**
+** This software is provided 'as-is', without any express or implied
+** warranty.  In no event will the authors be held liable for any damages
+** arising from the use of this software.
+**
+** Permission is granted to anyone to use this software for any purpose,
+** including commercial applications, and to alter it and redistribute it
+** freely, subject to the following restrictions:
+**
+** 1. The origin of this software must not be misrepresented; you must not
+**    claim that you wrote the original software. If you use this software
+**    in a product, an acknowledgment in the product documentation would be
+**    appreciated but is not required.
+** 2. Altered source versions must be plainly marked as such, and must not be
+**    misrepresented as being the original software.
+** 3. This notice may not be removed or altered from any source distribution.
+**
+**/
+
+#include <nms_common.h>
+#include <nms_agent.h>
+
+
+//
+// Hanlder functions
+//
+
+static LONG H_Version(const char *parameter, const char *arguments, char *value)
+{
+       ret_uint(value, 0x01000000);
+       return SYSINFO_RC_SUCCESS;
+}
+
+static LONG H_Echo(const char *parameter, const char *arguments, char *value)
+{
+       char tmp[256];
+       AgentGetParameterArg(parameter, 1, tmp, 255);
+       ret_string(value, tmp);
+       return SYSINFO_RC_SUCCESS;
+}
+
+static LONG H_Random(const char *parameter, const char *arguments, char *value)
+{
+       srand((unsigned int)time(NULL));
+       ret_int(value, rand() % 21 - 10);
+       return SYSINFO_RC_SUCCESS;
+}
+
+static LONG H_Enum(const char *parameter, const char *arguments, StringList *value)
+{
+       int i;
+       char tmp[256];
+
+       for(i = 0; i < 10; i++)
+       {
+               sprintf(tmp, "Value %d", i);
+               value->add(tmp);
+       }
+       return SYSINFO_RC_SUCCESS;
+}
+
+//
+// Action handler functions
+//
+static LONG H_ActionSample(const TCHAR *action, StringList *argumentsList, const TCHAR *data)
+{
+       return ERR_SUCCESS;
+}
+
+//
+// Called by master agent to initialize subagent
+//
+
+static BOOL SubAgentInit(Config *config)
+{
+       /* you can perform any initialization tasks here */
+       AgentWriteLog(EVENTLOG_INFORMATION_TYPE, _T("Sample subagent initialized"));
+       return TRUE;
+}
+
+
+//
+// Called by master agent at unload
+//
+
+static void SubAgentShutdown()
+{
+       /* you can perform necessary shutdown tasks here */
+       AgentWriteLog(EVENTLOG_INFORMATION_TYPE, _T("Sample subagent unloaded"));
+}
+
+
+//
+// Subagent information
+//
+
+static NETXMS_SUBAGENT_PARAM m_parameters[] =
+{
+       { "Sample.Version",                             H_Version,                              NULL,
+               DCI_DT_STRING, "Sample subagent version" },
+       { "Sample.Echo(*)",                             H_Echo,                                 NULL,
+               DCI_DT_STRING, "Echoes string back" },
+       { "Sample.Random",                                      H_Random,                               NULL,
+               DCI_DT_INT,    "Generates random number in range -10 .. 10" }
+};
+static NETXMS_SUBAGENT_LIST m_enums[] =
+{
+       { "Sample.List", H_Enum, NULL }
+};
+static NETXMS_SUBAGENT_ACTION m_actions[] =
+{
+       { "Sample.Action",                                      H_ActionSample, NULL, "Sample action" },
+};
+
+static NETXMS_SUBAGENT_INFO m_info =
+{
+       NETXMS_SUBAGENT_INFO_MAGIC,
+       _T("SAMPLE"), _T("1.0.0"),
+       SubAgentInit, SubAgentShutdown, NULL,
+       sizeof(m_parameters) / sizeof(NETXMS_SUBAGENT_PARAM),
+       m_parameters,
+       sizeof(m_enums) / sizeof(NETXMS_SUBAGENT_LIST),
+       m_enums,
+       0, NULL,        // tables
+       sizeof(m_actions) / sizeof(NETXMS_SUBAGENT_ACTION),
+       m_actions,
+       0, NULL // push parameters
+};
+
+
+//
+// Entry point for NetXMS agent
+//
+
+DECLARE_SUBAGENT_ENTRY_POINT(SAMPLE)
+{
+       *ppInfo = &m_info;
+       return TRUE;
+}
+
+
+//
+// DLL entry point
+//
+
+#ifdef _WIN32
+
+BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+{
+       if (dwReason == DLL_PROCESS_ATTACH)
+       {
+               DisableThreadLibraryCalls(hInstance);
+       }
+       return TRUE;
+}
+
+#endif
diff --git a/sdk/samples/C/subagent/sample-subagent.vcproj b/sdk/samples/C/subagent/sample-subagent.vcproj
new file mode 100644 (file)
index 0000000..91a6fe7
--- /dev/null
@@ -0,0 +1,364 @@
+<?xml version="1.0" encoding="windows-1251"?>\r
+<VisualStudioProject\r
+       ProjectType="Visual C++"\r
+       Version="8.00"\r
+       Name="sample-subagent"\r
+       ProjectGUID="{94F0ABB3-5B3E-483B-8B3B-E9E4D3BAC65A}"\r
+       RootNamespace="skeleton"\r
+       Keyword="Win32Proj"\r
+       >\r
+       <Platforms>\r
+               <Platform\r
+                       Name="Win32"\r
+               />\r
+               <Platform\r
+                       Name="x64"\r
+               />\r
+       </Platforms>\r
+       <ToolFiles>\r
+       </ToolFiles>\r
+       <Configurations>\r
+               <Configuration\r
+                       Name="Debug|Win32"\r
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
+                       ConfigurationType="2"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               AdditionalIncludeDirectories="C:\NetXMS\SDK\include\"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SKELETON_EXPORTS"\r
+                               MinimalRebuild="true"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="3"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="4"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               AdditionalDependencies="libnetxms.lib"\r
+                               LinkIncremental="2"\r
+                               AdditionalLibraryDirectories="C:\NetXMS\SDK\lib\x86"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="2"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Debug|x64"\r
+                       OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"\r
+                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
+                       ConfigurationType="2"\r
+                       CharacterSet="2"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                               TargetEnvironment="3"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
+                               AdditionalIncludeDirectories="C:\NetXMS\SDK\include\"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SKELETON_EXPORTS"\r
+                               MinimalRebuild="true"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="3"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="3"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               AdditionalDependencies="libnetxms.lib"\r
+                               LinkIncremental="2"\r
+                               AdditionalLibraryDirectories="C:\NetXMS\SDK\lib\x64"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="2"\r
+                               TargetMachine="17"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
+                       ConfigurationType="2"\r
+                       CharacterSet="2"\r
+                       WholeProgramOptimization="1"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               AdditionalIncludeDirectories="C:\NetXMS\SDK\include\"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SKELETON_EXPORTS"\r
+                               RuntimeLibrary="2"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="3"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               AdditionalDependencies="libnetxms.lib"\r
+                               LinkIncremental="1"\r
+                               AdditionalLibraryDirectories="C:\NetXMS\SDK\lib\x86"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="2"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               TargetMachine="1"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+               <Configuration\r
+                       Name="Release|x64"\r
+                       OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"\r
+                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
+                       ConfigurationType="2"\r
+                       CharacterSet="2"\r
+                       WholeProgramOptimization="1"\r
+                       >\r
+                       <Tool\r
+                               Name="VCPreBuildEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCustomBuildTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXMLDataGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebServiceProxyGeneratorTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCMIDLTool"\r
+                               TargetEnvironment="3"\r
+                       />\r
+                       <Tool\r
+                               Name="VCCLCompilerTool"\r
+                               AdditionalIncludeDirectories="C:\NetXMS\SDK\include\"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SKELETON_EXPORTS"\r
+                               RuntimeLibrary="2"\r
+                               UsePrecompiledHeader="0"\r
+                               WarningLevel="3"\r
+                               Detect64BitPortabilityProblems="true"\r
+                               DebugInformationFormat="3"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManagedResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCResourceCompilerTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPreLinkEventTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCLinkerTool"\r
+                               AdditionalDependencies="libnetxms.lib"\r
+                               LinkIncremental="1"\r
+                               AdditionalLibraryDirectories="C:\NetXMS\SDK\lib\x64"\r
+                               GenerateDebugInformation="true"\r
+                               SubSystem="2"\r
+                               OptimizeReferences="2"\r
+                               EnableCOMDATFolding="2"\r
+                               TargetMachine="17"\r
+                       />\r
+                       <Tool\r
+                               Name="VCALinkTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCManifestTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCXDCMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCBscMakeTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCFxCopTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCAppVerifierTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCWebDeploymentTool"\r
+                       />\r
+                       <Tool\r
+                               Name="VCPostBuildEventTool"\r
+                       />\r
+               </Configuration>\r
+       </Configurations>\r
+       <References>\r
+       </References>\r
+       <Files>\r
+               <Filter\r
+                       Name="Source Files"\r
+                       Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
+                       >\r
+                       <File\r
+                               RelativePath=".\sample-subagent.cpp"\r
+                               >\r
+                       </File>\r
+               </Filter>\r
+               <Filter\r
+                       Name="Header Files"\r
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"\r
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"\r
+                       >\r
+               </Filter>\r
+               <Filter\r
+                       Name="Resource Files"\r
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"\r
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"\r
+                       >\r
+               </Filter>\r
+       </Files>\r
+       <Globals>\r
+       </Globals>\r
+</VisualStudioProject>\r