+++ /dev/null
-#include <cstdio>
-#include <iostream>
-#include <i2-base.h>
-#include <i2-jsonrpc.h>
-
-using namespace icinga;
-
-using std::cout;
-using std::endl;
-
-namespace icinga
-{
-
-class MyApplication : public Application
-{
-private:
- ConfigHive::RefType m_Hive;
-
-public:
- typedef shared_ptr<MyApplication> RefType;
- typedef weak_ptr<MyApplication> WeakRefType;
-
- int Main(const vector<string>& args)
- {
- LoadComponent("configcomponent");
-
- m_Hive = new_object<ConfigHive>();
-
- /*ConfigFileSerializer::RefType cfs = new_object<ConfigFileSerializer>();
- cfs->SetFilename("test.conf");
- cfs->Deserialize(m_Hive);
-
- ConfigObject::RefType netconfig = m_Hive->GetObject("netconfig");
-
- JsonRpcServer::RefType ts = new_object<JsonRpcServer>();
- ts->MakeSocket();
- ts->Bind(netconfig->GetPropertyInteger("port", 7777));
- ts->Listen();
-
- ConnectionManager::RefType cm = new_object<ConnectionManager>();
- cm->RegisterMethod("HelloWorld", bind_weak(&MyApplication::HelloWorld, shared_from_this()));
- cm->RegisterServer(ts);
-
- ConfigRpcServiceModule::RefType rsm = new_object<ConfigRpcServiceModule>();
- rsm->SetHive(m_Hive);
- rsm->SetConfigSource(true);
- cm->RegisterServiceModule(rsm);*/
-
- RunEventLoop();
-
- return 0;
- }
-
- int HelloWorld(NewMessageEventArgs::RefType nea)
- {
- JsonRpcClient::RefType client = static_pointer_cast<JsonRpcClient>(nea->Source);
- JsonRpcMessage::RefType msg = nea->Message;
-
- JsonRpcMessage::RefType response = new_object<JsonRpcMessage>();
- response->SetVersion("2.0");
- response->SetID(msg->GetID());
- cJSON *result = response->GetResult();
- cJSON_AddStringToObject(result, "greeting", "Hello World!");
- client->SendMessage(response);
-
- ConfigObject::RefType co = new_object<ConfigObject>();
- co->SetName("foo");
- co->SetType("moo");
- m_Hive->AddObject(co);
-
- return 0;
- }
-};
-
-}
-
-SET_START_CLASS(icinga::MyApplication);
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{7CEA8AB1-3327-4644-9D38-B639A8F3341E}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>icinga</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <LinkIncremental>true</LinkIncremental>
- <LibraryPath>$(OutDir);$(LibraryPath)</LibraryPath>
- <IncludePath>$(ProjectDir)\..\base;$(ProjectDir)\..\jsonrpc;$(ProjectDir)\..\config;$(IncludePath)</IncludePath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <LinkIncremental>false</LinkIncremental>
- <LibraryPath>$(OutDir);$(LibraryPath)</LibraryPath>
- <IncludePath>$(ProjectDir)\..\base;$(ProjectDir)\..\jsonrpc;$(ProjectDir)\..\config;$(IncludePath)</IncludePath>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>base.lib;jsonrpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <Profile>true</Profile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>base.lib;jsonrpc.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="miniapp.cpp" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file