]> granicus.if.org Git - icinga2/commitdiff
Refactor JSON-RPC library and implement check-result messages.
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 27 Aug 2013 10:21:41 +0000 (12:21 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 27 Aug 2013 10:21:41 +0000 (12:21 +0200)
59 files changed:
components/Makefile.am
components/checker/Makefile.am
components/checker/checkercomponent.h
components/cluster/.gitignore [new file with mode: 0644]
components/cluster/Makefile.am [moved from lib/remoting/Makefile.am with 52% similarity]
components/cluster/cluster-type.conf [moved from lib/remoting/remoting-type.conf with 82% similarity]
components/cluster/cluster.vcxproj [moved from lib/remoting/remoting.vcxproj with 76% similarity]
components/cluster/cluster.vcxproj.filters [new file with mode: 0644]
components/cluster/clustercomponent.cpp [new file with mode: 0644]
components/cluster/clustercomponent.h [moved from lib/remoting/endpointmanager.h with 66% similarity]
components/cluster/endpoint.cpp [moved from lib/remoting/endpoint.cpp with 95% similarity]
components/cluster/endpoint.h [moved from lib/remoting/endpoint.h with 95% similarity]
components/cluster/jsonrpc.cpp [moved from lib/remoting/jsonrpc.cpp with 98% similarity]
components/cluster/jsonrpc.h [moved from lib/remoting/jsonrpc.h with 95% similarity]
components/compat/Makefile.am
components/compat/checkresultreader.h
components/compat/compatlog.h
components/demo/Makefile.am
components/demo/democomponent.cpp
components/demo/democomponent.h
components/ido_mysql/Makefile.am
components/livestatus/Makefile.am
components/notification/Makefile.am
configure.ac
contrib/config/osmc2012/icinga-c1.pem
contrib/config/osmc2012/icinga-c2.pem
contrib/config/osmc2012/icinga-c3.pem
contrib/gdb/icingadbg.py
lib/Makefile.am
lib/base/array.cpp
lib/base/array.h
lib/base/bufferedstream.cpp
lib/base/bufferedstream.h
lib/base/dictionary.cpp
lib/base/dictionary.h
lib/base/dynamicobject.cpp
lib/base/fifo.cpp
lib/base/fifo.h
lib/base/networkstream.cpp
lib/base/networkstream.h
lib/base/stdiostream.cpp
lib/base/stdiostream.h
lib/base/stream.h
lib/base/stream_bio.cpp
lib/base/tlsstream.cpp
lib/base/tlsstream.h
lib/config/configitem.cpp
lib/icinga/Makefile.am
lib/icinga/icinga-type.conf
lib/icinga/icingaapplication.cpp
lib/icinga/icingaapplication.h
lib/icinga/notification.cpp
lib/icinga/service-check.cpp
lib/ido/Makefile.am
lib/python/Makefile.am
lib/remoting/.gitignore [deleted file]
lib/remoting/endpointmanager.cpp [deleted file]
lib/remoting/i2-remoting.h [deleted file]
lib/remoting/remoting.vcxproj.filters [deleted file]

index 6b78c486f66d31afea9ff5c717b32e952590602a..4564ae736c55e44e6ab6001d306fb7996fb18971 100644 (file)
@@ -3,6 +3,7 @@
 
 SUBDIRS = \
        checker \
+       cluster \
        compat \
        demo \
        ido_mysql \
index 566d18b00821637175d828de0977ad987d7189e6..514ab5a3b99c6ed2245f2f1a895c43d990328800 100644 (file)
@@ -33,5 +33,4 @@ libchecker_la_LIBADD = \
        $(BOOST_SYSTEM_LIB) \
        ${top_builddir}/lib/base/libbase.la \
        ${top_builddir}/lib/config/libconfig.la \
-       ${top_builddir}/lib/remoting/libremoting.la \
        ${top_builddir}/lib/icinga/libicinga.la
index d7fb22de65c1570c1285a44f846cc430d4f5fa99..c16f185086744061f3725ba8ff90d2c89bf760cc 100644 (file)
@@ -21,7 +21,6 @@
 #define CHECKERCOMPONENT_H
 
 #include "icinga/service.h"
-#include "remoting/endpoint.h"
 #include "base/dynamicobject.h"
 #include "base/timer.h"
 #include <boost/thread/thread.hpp>
diff --git a/components/cluster/.gitignore b/components/cluster/.gitignore
new file mode 100644 (file)
index 0000000..f180b9c
--- /dev/null
@@ -0,0 +1 @@
+cluster-type.cpp
similarity index 52%
rename from lib/remoting/Makefile.am
rename to components/cluster/Makefile.am
index dc15e18d7359ee2464bf0b97b86dfc250e4adaaf..90406efb89afc1b718bf3be2cb99a73a8f298f83 100644 (file)
@@ -1,36 +1,40 @@
 ## Process this file with automake to produce Makefile.in
 
-
 pkglib_LTLIBRARIES = \
-       libremoting.la
+       libcluster.la
+
+EXTRA_DIST = \
+       cluster-type.conf
 
 .conf.cpp: $(top_builddir)/tools/mkembedconfig/mkembedconfig.c
        $(top_builddir)/tools/mkembedconfig/mkembedconfig $< $@
 
-libremoting_la_SOURCES = \
+libcluster_la_SOURCES = \
+       clustercomponent.cpp \
+       clustercomponent.h \
+       cluster-type.cpp \
        endpoint.cpp \
        endpoint.h \
-       endpointmanager.cpp \
-       endpointmanager.h \
-       i2-remoting.h \
        jsonrpc.cpp \
-       jsonrpc.h \
-       remoting-type.cpp
+       jsonrpc.h
 
-libremoting_la_CPPFLAGS = \
-       -DI2_REMOTING_BUILD \
+libcluster_la_CPPFLAGS = \
        $(LTDLINCL) \
        $(BOOST_CPPFLAGS) \
-       -I${top_srcdir}/lib
+       -I${top_srcdir}/lib \
+       -I${top_srcdir}/components
 
-libremoting_la_LDFLAGS = \
+libcluster_la_LDFLAGS = \
        $(BOOST_LDFLAGS) \
+       -module \
        -no-undefined \
        @RELEASE_INFO@ \
        @VERSION_INFO@
 
-libremoting_la_LIBADD = \
+libcluster_la_LIBADD = \
+       $(BOOST_SIGNALS_LIB) \
        $(BOOST_THREAD_LIB) \
        $(BOOST_SYSTEM_LIB) \
        ${top_builddir}/lib/base/libbase.la \
-       ${top_builddir}/lib/config/libconfig.la
+       ${top_builddir}/lib/config/libconfig.la \
+       ${top_builddir}/lib/icinga/libicinga.la
similarity index 82%
rename from lib/remoting/remoting-type.conf
rename to components/cluster/cluster-type.conf
index 5eab4660c3e64e728d79d44d413be2826542af1a..dfb9dd7bfbff6f879406e9cff22716e0b8355ee3 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
+type ClusterComponent {
+       %attribute string "cert_path",
+       %require "cert_path",
+
+       %attribute string "ca_path",
+       %require "ca_path",
+
+       %attribute string "bind_host",
+       %attribute string "bind_port",
+
+       %attribute array "peers" {
+               %attribute string "*"
+       }
+}
+
 type Endpoint {
-       %attribute string "node",
-       %attribute string "service",
-       %attribute number "local"
+       %attribute string "host",
+       %attribute string "port"
 }
similarity index 76%
rename from lib/remoting/remoting.vcxproj
rename to components/cluster/cluster.vcxproj
index f3dba42f3bc3ee69d9f07803fae0c72133cd3ee7..fcf55e5d2b5097ee2b70cf765854eb28bdeb3e48 100644 (file)
       <Platform>x64</Platform>
     </ProjectConfiguration>
   </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="endpoint.h" />
-    <ClInclude Include="endpointmanager.h" />
-    <ClInclude Include="i2-remoting.h" />
-    <ClInclude Include="jsonrpc.h" />
-    <ClInclude Include="requestmessage.h" />
-    <ClInclude Include="responsemessage.h" />
-    <ClInclude Include="messagepart.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClCompile Include="endpoint.cpp" />
-    <ClCompile Include="endpointmanager.cpp" />
-    <ClCompile Include="jsonrpc.cpp" />
-    <ClCompile Include="remoting-type.cpp">
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
-    </ClCompile>
-    <ClCompile Include="requestmessage.cpp" />
-    <ClCompile Include="responsemessage.cpp" />
-    <ClCompile Include="messagepart.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <CustomBuild Include="remoting-type.conf">
-      <FileType>Document</FileType>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(SolutionDir)$(Platform)\$(Configuration)\mkembedconfig.exe" "%(Identity)" "%(Filename).cpp"</Command>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Preparing config fragment for embedding</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(SolutionDir)$(Platform)\$(Configuration)\mkembedconfig.exe" "%(Identity)" "%(Filename).cpp"</Command>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Preparing config fragment for embedding</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(SolutionDir)$(Platform)\$(Configuration)\mkembedconfig.exe" "%(Identity)" "%(Filename).cpp"</Command>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Preparing config fragment for embedding</Message>
-      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(SolutionDir)$(Platform)\$(Configuration)\mkembedconfig.exe" "%(Identity)" "%(Filename).cpp"</Command>
-      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Preparing config fragment for embedding</Message>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename).cpp;%(Outputs)</Outputs>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Filename).cpp;%(Outputs)</Outputs>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).cpp;%(Outputs)</Outputs>
-      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).cpp;%(Outputs)</Outputs>
-      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\tools\mkembedconfig\mkembedconfig.c</AdditionalInputs>
-      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\tools\mkembedconfig\mkembedconfig.c</AdditionalInputs>
-      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\tools\mkembedconfig\mkembedconfig.c</AdditionalInputs>
-      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\tools\mkembedconfig\mkembedconfig.c</AdditionalInputs>
-    </CustomBuild>
-  </ItemGroup>
   <PropertyGroup Label="Globals">
-    <ProjectGuid>{8DD52FAC-ECEE-48C2-B266-E7C47ED485F8}</ProjectGuid>
+    <ProjectGuid>{2E6C1133-730F-4875-A72C-B455B1DD4C5C}</ProjectGuid>
     <Keyword>Win32Proj</Keyword>
-    <RootNamespace>icinga</RootNamespace>
+    <RootNamespace>demo</RootNamespace>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <IncludePath>$(SolutionDir)\lib;$(IncludePath)</IncludePath>
+    <LinkIncremental>true</LinkIncremental>
+    <IncludePath>$(SolutionDir)\lib;$(SolutionDir)\components;$(IncludePath)</IncludePath>
     <LibraryPath>$(SolutionDir)$(Platform)\$(Configuration)\;$(LibraryPath)</LibraryPath>
     <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir>$(Platform)\$(Configuration)\</IntDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
-    <IncludePath>$(SolutionDir)\lib;$(IncludePath)</IncludePath>
+    <LinkIncremental>true</LinkIncremental>
+    <IncludePath>$(SolutionDir)\lib;$(SolutionDir)\components;$(IncludePath)</IncludePath>
     <LibraryPath>$(SolutionDir)$(Platform)\$(Configuration)\;$(LibraryPath)</LibraryPath>
     <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir>$(Platform)\$(Configuration)\</IntDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <IncludePath>$(SolutionDir)\lib;$(IncludePath)</IncludePath>
+    <LinkIncremental>false</LinkIncremental>
+    <IncludePath>$(SolutionDir)\lib;$(SolutionDir)\components;$(IncludePath)</IncludePath>
     <LibraryPath>$(SolutionDir)$(Platform)\$(Configuration)\;$(LibraryPath)</LibraryPath>
     <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir>$(Platform)\$(Configuration)\</IntDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
-    <IncludePath>$(SolutionDir)\lib;$(IncludePath)</IncludePath>
+    <LinkIncremental>false</LinkIncremental>
+    <IncludePath>$(SolutionDir)\lib;$(SolutionDir)\components;$(IncludePath)</IncludePath>
     <LibraryPath>$(SolutionDir)$(Platform)\$(Configuration)\;$(LibraryPath)</LibraryPath>
     <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
     <IntDir>$(Platform)\$(Configuration)\</IntDir>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;I2_REMOTING_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <WarningLevel>Level3</WarningLevel>
       <MinimalRebuild>false</MinimalRebuild>
-      <PrecompiledHeaderFile>i2-remoting.h</PrecompiledHeaderFile>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>base.lib;config.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>base.lib;config.lib;remoting.lib;icinga.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
-    <Lib>
-      <AdditionalDependencies>
-      </AdditionalDependencies>
-    </Lib>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <ClCompile>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
       <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;I2_REMOTING_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <WarningLevel>Level3</WarningLevel>
       <MinimalRebuild>false</MinimalRebuild>
-      <PrecompiledHeaderFile>i2-remoting.h</PrecompiledHeaderFile>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>base.lib;config.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>base.lib;config.lib;remoting.lib;icinga.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
-    <Lib>
-      <AdditionalDependencies>
-      </AdditionalDependencies>
-    </Lib>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;I2_REMOTING_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+      <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <WarningLevel>Level3</WarningLevel>
       <MinimalRebuild>false</MinimalRebuild>
-      <PrecompiledHeaderFile>i2-remoting.h</PrecompiledHeaderFile>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>base.lib;config.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>base.lib;config.lib;remoting.lib;icinga.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
-    <Lib>
-      <AdditionalDependencies>
-      </AdditionalDependencies>
-    </Lib>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <ClCompile>
-      <PrecompiledHeader>NotUsing</PrecompiledHeader>
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;I2_REMOTING_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+      <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <WarningLevel>Level3</WarningLevel>
       <MinimalRebuild>false</MinimalRebuild>
-      <PrecompiledHeaderFile>i2-remoting.h</PrecompiledHeaderFile>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>base.lib;config.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>base.lib;config.lib;remoting.lib;icinga.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
-    <Lib>
-      <AdditionalDependencies>
-      </AdditionalDependencies>
-    </Lib>
   </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClInclude Include="democomponent.h" />
+    <ClInclude Include="i2-demo.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="demo-type.cpp" />
+    <ClCompile Include="democomponent.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <CustomBuild Include="demo-type.conf">
+      <FileType>Document</FileType>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(SolutionDir)$(Platform)\$(Configuration)\mkembedconfig.exe" "%(Identity)" "%(Filename).cpp"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Preparing config fragment for embedding</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(SolutionDir)$(Platform)\$(Configuration)\mkembedconfig.exe" "%(Identity)" "%(Filename).cpp"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Preparing config fragment for embedding</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(SolutionDir)$(Platform)\$(Configuration)\mkembedconfig.exe" "%(Identity)" "%(Filename).cpp"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Preparing config fragment for embedding</Message>
+      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(SolutionDir)$(Platform)\$(Configuration)\mkembedconfig.exe" "%(Identity)" "%(Filename).cpp"</Command>
+      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Preparing config fragment for embedding</Message>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename).cpp;%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Filename).cpp;%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).cpp;%(Outputs)</Outputs>
+      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).cpp;%(Outputs)</Outputs>
+      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)\tools\mkembedconfig\mkembedconfig.c</AdditionalInputs>
+      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)\tools\mkembedconfig\mkembedconfig.c</AdditionalInputs>
+      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)\tools\mkembedconfig\mkembedconfig.c</AdditionalInputs>
+      <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)\tools\mkembedconfig\mkembedconfig.c</AdditionalInputs>
+    </CustomBuild>
+  </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
diff --git a/components/cluster/cluster.vcxproj.filters b/components/cluster/cluster.vcxproj.filters
new file mode 100644 (file)
index 0000000..922435a
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <ClInclude Include="democomponent.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+    <ClInclude Include="i2-demo.h">
+      <Filter>Headerdateien</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <Filter Include="Headerdateien">
+      <UniqueIdentifier>{11a495bf-a705-4766-b3d3-9b5db266a6ef}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Quelldateien">
+      <UniqueIdentifier>{1fb6337f-a17f-46ea-9316-2d800a94b53d}</UniqueIdentifier>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="democomponent.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+    <ClCompile Include="demo-type.cpp">
+      <Filter>Quelldateien</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <CustomBuild Include="demo-type.conf">
+      <Filter>Quelldateien</Filter>
+    </CustomBuild>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/components/cluster/clustercomponent.cpp b/components/cluster/clustercomponent.cpp
new file mode 100644 (file)
index 0000000..2bd7d29
--- /dev/null
@@ -0,0 +1,316 @@
+/******************************************************************************
+ * Icinga 2                                                                   *
+ * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/)        *
+ *                                                                            *
+ * This program is free software; you can redistribute it and/or              *
+ * modify it under the terms of the GNU General Public License                *
+ * as published by the Free Software Foundation; either version 2             *
+ * of the License, or (at your option) any later version.                     *
+ *                                                                            *
+ * This program is distributed in the hope that it will be useful,            *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
+ * GNU General Public License for more details.                               *
+ *                                                                            *
+ * You should have received a copy of the GNU General Public License          *
+ * along with this program; if not, write to the Free Software Foundation     *
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
+ ******************************************************************************/
+
+#include "cluster/clustercomponent.h"
+#include "cluster/endpoint.h"
+#include "base/dynamictype.h"
+#include "base/logger_fwd.h"
+#include "base/objectlock.h"
+#include "base/networkstream.h"
+#include <boost/smart_ptr/make_shared.hpp>
+
+using namespace icinga;
+
+REGISTER_TYPE(ClusterComponent);
+
+/**
+ * Starts the component.
+ */
+void ClusterComponent::Start(void)
+{
+       DynamicObject::Start();
+
+       /* set up SSL context */
+       shared_ptr<X509> cert = GetX509Certificate(GetCertificateFile());
+       m_Identity = GetCertificateCN(cert);
+       Log(LogInformation, "cluster", "My identity: " + m_Identity);
+
+       m_SSLContext = MakeSSLContext(GetCertificateFile(), GetCertificateFile(), GetCAFile());
+
+       /* create the primary JSON-RPC listener */
+       if (!GetBindPort().IsEmpty())
+               AddListener(GetBindPort());
+
+       m_ReconnectTimer = boost::make_shared<Timer>();
+       m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&ClusterComponent::ReconnectTimerHandler, this));
+       m_ReconnectTimer->SetInterval(5);
+       m_ReconnectTimer->Start();
+
+       Service::OnNewCheckResult.connect(bind(&ClusterComponent::CheckResultHandler, this, _1, _2));
+       Endpoint::OnMessageReceived.connect(bind(&ClusterComponent::MessageHandler, this, _1, _2));
+}
+
+/**
+ * Stops the component.
+ */
+void ClusterComponent::Stop(void)
+{
+       /* Nothing to do here. */
+}
+
+String ClusterComponent::GetCertificateFile(void) const
+{
+       ObjectLock olock(this);
+
+       return m_CertPath;
+}
+
+String ClusterComponent::GetCAFile(void) const
+{
+       ObjectLock olock(this);
+
+       return m_CAPath;
+}
+
+String ClusterComponent::GetBindHost(void) const
+{
+       ObjectLock olock(this);
+
+       return m_BindHost;
+}
+
+String ClusterComponent::GetBindPort(void) const
+{
+       ObjectLock olock(this);
+
+       return m_BindPort;
+}
+
+Array::Ptr ClusterComponent::GetPeers(void) const
+{
+       ObjectLock olock(this);
+
+       return m_Peers;
+}
+
+shared_ptr<SSL_CTX> ClusterComponent::GetSSLContext(void) const
+{
+       ObjectLock olock(this);
+
+       return m_SSLContext;
+}
+
+String ClusterComponent::GetIdentity(void) const
+{
+       ObjectLock olock(this);
+
+       return m_Identity;
+}
+
+/**
+ * Creates a new JSON-RPC listener on the specified port.
+ *
+ * @param service The port to listen on.
+ */
+void ClusterComponent::AddListener(const String& service)
+{
+       ObjectLock olock(this);
+
+       shared_ptr<SSL_CTX> sslContext = m_SSLContext;
+
+       if (!sslContext)
+               BOOST_THROW_EXCEPTION(std::logic_error("SSL context is required for AddListener()"));
+
+       std::ostringstream s;
+       s << "Adding new listener: port " << service;
+       Log(LogInformation, "cluster", s.str());
+
+       TcpSocket::Ptr server = boost::make_shared<TcpSocket>();
+       server->Bind(service, AF_INET6);
+
+       boost::thread thread(boost::bind(&ClusterComponent::ListenerThreadProc, this, server));
+       thread.detach();
+
+       m_Servers.insert(server);
+}
+
+void ClusterComponent::ListenerThreadProc(const Socket::Ptr& server)
+{
+       server->Listen();
+
+       for (;;) {
+               Socket::Ptr client = server->Accept();
+
+               try {
+                       NewClientHandler(client, TlsRoleServer);
+               } catch (const std::exception& ex) {
+                       std::stringstream message;
+                       message << "Error for new JSON-RPC socket: " << boost::diagnostic_information(ex);
+                       Log(LogInformation, "cluster", message.str());
+               }
+       }
+}
+
+/**
+ * Creates a new JSON-RPC client and connects to the specified host and port.
+ *
+ * @param node The remote host.
+ * @param service The remote port.
+ */
+void ClusterComponent::AddConnection(const String& node, const String& service) {
+       {
+               ObjectLock olock(this);
+
+               shared_ptr<SSL_CTX> sslContext = m_SSLContext;
+
+               if (!sslContext)
+                       BOOST_THROW_EXCEPTION(std::logic_error("SSL context is required for AddConnection()"));
+       }
+
+       TcpSocket::Ptr client = boost::make_shared<TcpSocket>();
+
+       try {
+               client->Connect(node, service);
+               NewClientHandler(client, TlsRoleClient);
+       } catch (const std::exception& ex) {
+               Log(LogInformation, "cluster", "Could not connect to " + node + ":" + service + ": " + ex.what());
+       }
+}
+
+/**
+ * Processes a new client connection.
+ *
+ * @param client The new client.
+ */
+void ClusterComponent::NewClientHandler(const Socket::Ptr& client, TlsRole role)
+{
+       NetworkStream::Ptr netStream = boost::make_shared<NetworkStream>(client);
+
+       TlsStream::Ptr tlsStream = boost::make_shared<TlsStream>(netStream, role, m_SSLContext);
+       tlsStream->Handshake();
+
+       shared_ptr<X509> cert = tlsStream->GetPeerCertificate();
+       String identity = GetCertificateCN(cert);
+
+       Log(LogInformation, "cluster", "New client connection for identity '" + identity + "'");
+
+       Endpoint::Ptr endpoint = Endpoint::GetByName(identity);
+
+       if (!endpoint) {
+               Log(LogInformation, "cluster", "Closing endpoint '" + identity + "': No configuration available.");
+               tlsStream->Close();
+               return;
+       }
+
+       endpoint->SetClient(tlsStream);
+}
+
+void ClusterComponent::ReconnectTimerHandler(void)
+{
+       Array::Ptr peers = GetPeers();
+
+       if (!peers)
+               return;
+
+       ObjectLock olock(peers);
+       BOOST_FOREACH(const String& peer, peers) {
+               Endpoint::Ptr endpoint = Endpoint::GetByName(peer);
+
+               if (!endpoint)
+                       continue;
+
+               if (endpoint->IsConnected())
+                       continue;
+
+               String host, port;
+               host = endpoint->GetHost();
+               port = endpoint->GetPort();
+
+               if (host.IsEmpty() || port.IsEmpty()) {
+                       Log(LogWarning, "cluster", "Can't reconnect "
+                           "to endpoint '" + endpoint->GetName() + "': No "
+                           "host/port information.");
+                       continue;
+               }
+
+               Log(LogInformation, "cluster", "Attempting to reconnect to cluster endpoint '" + endpoint->GetName() + "' via '" + host + ":" + port + "'.");
+               AddConnection(host, port);
+       }
+}
+
+void ClusterComponent::CheckResultHandler(const Service::Ptr& service, const Dictionary::Ptr& cr)
+{
+       if (cr->Contains("source") && cr->Get("source") != GetIdentity())
+               return;
+
+       cr->Set("source", GetIdentity());
+
+       Dictionary::Ptr params = boost::make_shared<Dictionary>();
+       params->Set("service", service->GetName());
+       params->Set("check_result", cr);
+
+       Dictionary::Ptr message = boost::make_shared<Dictionary>();
+       message->Set("jsonrpc", "2.0");
+       message->Set("method", "cluster::CheckResult");
+       message->Set("params", params);
+
+       BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>()) {
+               endpoint->SendMessage(message);
+       }
+}
+
+void ClusterComponent::MessageHandler(const Endpoint::Ptr& endpoint, const Dictionary::Ptr& message)
+{
+       if (message->Get("method") == "cluster::CheckResult") {
+               Dictionary::Ptr params = message->Get("params");
+
+               if (!params)
+                       return;
+
+               Dictionary::Ptr cr = params->Get("check_result");
+
+               if (!cr)
+                       return;
+
+               String svc = params->Get("service");
+
+               Service::Ptr service = Service::GetByName(svc);
+
+               if (!service)
+                       return;
+
+               service->ProcessCheckResult(cr);
+       }
+}
+
+void ClusterComponent::InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) const
+{
+       DynamicObject::InternalSerialize(bag, attributeTypes);
+
+       if (attributeTypes & Attribute_Config) {
+               bag->Set("cert_path", m_CertPath);
+               bag->Set("ca_path", m_CAPath);
+               bag->Set("bind_host", m_BindHost);
+               bag->Set("bind_port", m_BindPort);
+               bag->Set("peers", m_Peers);
+       }
+}
+
+void ClusterComponent::InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes)
+{
+       DynamicObject::InternalDeserialize(bag, attributeTypes);
+
+       if (attributeTypes & Attribute_Config) {
+               m_CertPath = bag->Get("cert_path");
+               m_CAPath = bag->Get("ca_path");
+               m_BindHost = bag->Get("bind_host");
+               m_BindPort = bag->Get("bind_port");
+               m_Peers = bag->Get("peers");
+       }
+}
similarity index 66%
rename from lib/remoting/endpointmanager.h
rename to components/cluster/clustercomponent.h
index 7fa5d66537423317be17080e54a8d34e00a232e3..06b752c97baefe115ebb2d95dd5fe1acdef6bd75 100644 (file)
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#ifndef ENDPOINTMANAGER_H
-#define ENDPOINTMANAGER_H
+#ifndef CLUSTERCOMPONENT_H
+#define CLUSTERCOMPONENT_H
 
-#include "remoting/i2-remoting.h"
-#include "remoting/endpoint.h"
+#include "base/dynamicobject.h"
+#include "base/timer.h"
+#include "base/array.h"
 #include "base/tcpsocket.h"
 #include "base/tlsstream.h"
-#include "base/timer.h"
 #include "base/utility.h"
-#include <boost/signals2.hpp>
+#include "base/tlsutility.h"
+#include "icinga/service.h"
+#include "cluster/endpoint.h"
 
 namespace icinga
 {
 
 /**
- * Forwards messages between endpoints.
- *
- * @ingroup remoting
+ * @ingroup demo
  */
-class I2_REMOTING_API EndpointManager : public Object
+class ClusterComponent : public DynamicObject
 {
 public:
-       DECLARE_PTR_TYPEDEFS(EndpointManager);
+       DECLARE_PTR_TYPEDEFS(ClusterComponent);
+       DECLARE_TYPENAME(ClusterComponent);
 
-       EndpointManager(void);
+       virtual void Start(void);
+       virtual void Stop(void);
 
-       static EndpointManager *GetInstance(void);
+       String GetCertificateFile(void) const;
+       String GetCAFile(void) const;
+       String GetBindHost(void) const;
+       String GetBindPort(void) const;
+       Array::Ptr GetPeers(void) const;
 
-       void SetIdentity(const String& identity);
-       String GetIdentity(void) const;
-
-       void SetSSLContext(const shared_ptr<SSL_CTX>& sslContext);
        shared_ptr<SSL_CTX> GetSSLContext(void) const;
+       String GetIdentity(void) const;
 
-       void AddListener(const String& service);
-       void AddConnection(const String& node, const String& service);
-
-       //void SendUnicastMessage(const Endpoint::Ptr& recipient, const Dictionary::Ptr& message);
-       //void SendUnicastMessage(const Endpoint::Ptr& sender, const Endpoint::Ptr& recipient, const MessagePart& message);
-       //void SendAnycastMessage(const Endpoint::Ptr& sender, const RequestMessage& message);
-       //void SendMulticastMessage(const RequestMessage& message);
-       //void SendMulticastMessage(const Endpoint::Ptr& sender, const RequestMessage& message);
-
-       boost::signals2::signal<void (const Endpoint::Ptr&)> OnNewEndpoint;
+protected:
+       virtual void InternalSerialize(const Dictionary::Ptr& bag, int attributeTypes) const;
+       virtual void InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes);
 
 private:
-       String m_Identity;
-       Endpoint::Ptr m_Endpoint;
+       String m_CertPath;
+       String m_CAPath;
+       String m_BindHost;
+       String m_BindPort;
+       Array::Ptr m_Peers;
 
        shared_ptr<SSL_CTX> m_SSLContext;
+       String m_Identity;
 
        Timer::Ptr m_ReconnectTimer;
+       void ReconnectTimerHandler(void);
 
        std::set<TcpSocket::Ptr> m_Servers;
 
-       void ReconnectTimerHandler(void);
+       void AddListener(const String& service);
+       void AddConnection(const String& node, const String& service);
 
        void NewClientHandler(const Socket::Ptr& client, TlsRole role);
-
        void ListenerThreadProc(const Socket::Ptr& server);
+
+       void CheckResultHandler(const Service::Ptr& service, const Dictionary::Ptr& cr);
+       void MessageHandler(const Endpoint::Ptr& endpoint, const Dictionary::Ptr& message);
+
 };
 
 }
 
-#endif /* ENDPOINTMANAGER_H */
+#endif /* CLUSTERCOMPONENT_H */
similarity index 95%
rename from lib/remoting/endpoint.cpp
rename to components/cluster/endpoint.cpp
index c6d5c1f5c5eedfccecd4f0f61678c9a29ce0b9e2..5194837e28b152a9e8f5c97e152e84eef5854897 100644 (file)
@@ -17,9 +17,8 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "remoting/endpoint.h"
-#include "remoting/endpointmanager.h"
-#include "remoting/jsonrpc.h"
+#include "cluster/endpoint.h"
+#include "cluster/jsonrpc.h"
 #include "base/application.h"
 #include "base/dynamictype.h"
 #include "base/objectlock.h"
@@ -78,7 +77,7 @@ void Endpoint::SendMessage(const Dictionary::Ptr& message)
        } catch (const std::exception& ex) {
                std::ostringstream msgbuf;
                msgbuf << "Error while sending JSON-RPC message for endpoint '" << GetName() << "': " << boost::diagnostic_information(ex);
-               Log(LogWarning, "remoting", msgbuf.str());
+               Log(LogWarning, "cluster", msgbuf.str());
 
                m_Client.reset();
        }
@@ -92,9 +91,11 @@ void Endpoint::MessageThreadProc(const Stream::Ptr& stream)
                try {
                        message = JsonRpc::ReadMessage(stream);
                } catch (const std::exception& ex) {
-                       Log(LogWarning, "jsonrpc", "Error while reading JSON-RPC message for endpoint '" + GetName() + "': " + boost::diagnostic_information(ex));
+                       Log(LogWarning, "cluster", "Error while reading JSON-RPC message for endpoint '" + GetName() + "': " + boost::diagnostic_information(ex));
 
                        m_Client.reset();
+
+                       return;
                }
 
                Utility::QueueAsyncCallback(bind(boost::ref(Endpoint::OnMessageReceived), GetSelf(), message));
similarity index 95%
rename from lib/remoting/endpoint.h
rename to components/cluster/endpoint.h
index 22899ed35ae009adece7170a17ed790ca4656b8a..834ae0b593d581c979d7da1c8971ca1e7685f8be 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef ENDPOINT_H
 #define ENDPOINT_H
 
-#include "remoting/i2-remoting.h"
 #include "base/dynamicobject.h"
 #include "base/stream.h"
 #include <boost/signals2.hpp>
@@ -33,9 +32,9 @@ class EndpointManager;
 /**
  * An endpoint that can be used to send and receive messages.
  *
- * @ingroup remoting
+ * @ingroup cluster
  */
-class I2_REMOTING_API Endpoint : public DynamicObject
+class Endpoint : public DynamicObject
 {
 public:
        DECLARE_PTR_TYPEDEFS(Endpoint);
similarity index 98%
rename from lib/remoting/jsonrpc.cpp
rename to components/cluster/jsonrpc.cpp
index 73e9f100380b8056da91aa4d954c8bd2d8b36755..2cc19f8288b0f3ef65ac221621e7086413a78567 100644 (file)
@@ -17,7 +17,7 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "remoting/jsonrpc.h"
+#include "cluster/jsonrpc.h"
 #include "base/netstring.h"
 #include "base/objectlock.h"
 #include "base/logger_fwd.h"
similarity index 95%
rename from lib/remoting/jsonrpc.h
rename to components/cluster/jsonrpc.h
index ece2c096a969b51b704fbe7a5f52e232763bc6fb..e849c94f2aa6317bb28be749957070a127f6df34 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef JSONRPC_H
 #define JSONRPC_H
 
-#include "remoting/i2-remoting.h"
 #include "base/stream.h"
 #include "base/dictionary.h"
 
@@ -30,9 +29,9 @@ namespace icinga
 /**
  * A JSON-RPC connection.
  *
- * @ingroup remoting
+ * @ingroup cluster
  */
-class I2_REMOTING_API JsonRpc
+class JsonRpc
 {
 public:
        static void SendMessage(const Stream::Ptr& stream, const Dictionary::Ptr& message);
index 02d40d3336d481ef7227323b9d538b9217229b25..590da329a680973daf19defae407a07734650158 100644 (file)
@@ -37,5 +37,4 @@ libcompat_la_LIBADD = \
        $(BOOST_SYSTEM_LIB) \
        ${top_builddir}/lib/base/libbase.la \
        ${top_builddir}/lib/config/libconfig.la \
-       ${top_builddir}/lib/remoting/libremoting.la \
        ${top_builddir}/lib/icinga/libicinga.la
index a46b988682d5e44ef44f421c9aca443bef7fe55f..7c818d0d5b02bf465f196ba6adfcd41aa2331d55 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef CHECKRESULTREADER_H
 #define CHECKRESULTREADER_H
 
-#include "remoting/endpoint.h"
 #include "base/dynamicobject.h"
 #include "base/timer.h"
 #include <fstream>
index d3f73a678d2ebdab47404f9d4e4a605b09ae3201..67adebac6b4ee67179fbb22009c400713a17f701 100644 (file)
@@ -21,7 +21,6 @@
 #define COMPATLOG_H
 
 #include "icinga/service.h"
-#include "remoting/endpoint.h"
 #include "base/dynamicobject.h"
 #include "base/timer.h"
 #include <fstream>
index 30fd414f2950ddd3402a2f35448188154c58f186..7a1f5363f62673d598eeeefd8a9ac6c25e029bff 100644 (file)
@@ -33,5 +33,4 @@ libdemo_la_LIBADD = \
        $(BOOST_SYSTEM_LIB) \
        ${top_builddir}/lib/base/libbase.la \
        ${top_builddir}/lib/config/libconfig.la \
-       ${top_builddir}/lib/remoting/libremoting.la \
        ${top_builddir}/lib/icinga/libicinga.la
index d0bab258016ea875c7bd71444b04bad8c0faa6b2..af592fa2a4f7646238a1ed69e9a64185b7cd6e4a 100644 (file)
@@ -18,7 +18,6 @@
  ******************************************************************************/
 
 #include "demo/democomponent.h"
-#include "remoting/endpointmanager.h"
 #include "base/dynamictype.h"
 #include "base/logger_fwd.h"
 #include <boost/smart_ptr/make_shared.hpp>
index ea78933c6ae16ef82b9270568482a4d729e7e630..f4990f1e4211f288478cc531804fb3cc5ba87b44 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef DEMOCOMPONENT_H
 #define DEMOCOMPONENT_H
 
-#include "remoting/endpoint.h"
 #include "base/dynamicobject.h"
 #include "base/timer.h"
 
@@ -34,6 +33,7 @@ class DemoComponent : public DynamicObject
 {
 public:
        DECLARE_PTR_TYPEDEFS(DemoComponent);
+       DECLARE_TYPENAME(DemoComponent);
 
        virtual void Start(void);
        virtual void Stop(void);
index 65ee462f18121f1fb4cc8124de8fca1e81d8751d..058909d1fce9389936253ce15c7a6ea2a67719e4 100644 (file)
@@ -36,7 +36,6 @@ libido_mysql_la_LIBADD = \
        $(BOOST_SYSTEM_LIB) \
        ${top_builddir}/lib/base/libbase.la \
        ${top_builddir}/lib/config/libconfig.la \
-       ${top_builddir}/lib/remoting/libremoting.la \
        ${top_builddir}/lib/icinga/libicinga.la \
        ${top_builddir}/lib/ido/libido.la
 
index 4fdd7939c8a41c79651d2702da62b01fdb57ffe8..8af321a160284b8a5b9617bdfe483c148f257861 100644 (file)
@@ -93,5 +93,4 @@ liblivestatus_la_LIBADD = \
        $(BOOST_SYSTEM_LIB) \
        ${top_builddir}/lib/base/libbase.la \
        ${top_builddir}/lib/config/libconfig.la \
-       ${top_builddir}/lib/remoting/libremoting.la \
        ${top_builddir}/lib/icinga/libicinga.la
index a9bfbad5d7276514c6e4e2c1a9c1eae1134914de..4c525af9b2c85f32a89cd0518b6d5a70d881903b 100644 (file)
@@ -33,5 +33,4 @@ libnotification_la_LIBADD = \
        $(BOOST_SYSTEM_LIB) \
        ${top_builddir}/lib/base/libbase.la \
        ${top_builddir}/lib/config/libconfig.la \
-       ${top_builddir}/lib/remoting/libremoting.la \
        ${top_builddir}/lib/icinga/libicinga.la
index 6df0855f5df509d47839a943ba3f9552055c1093..26c39a9b96b03bc26585960b333e59aa2bcc49f0 100644 (file)
@@ -123,6 +123,7 @@ AC_CONFIG_FILES([
 Makefile
 components/Makefile
 components/checker/Makefile
+components/cluster/Makefile
 components/compat/Makefile
 components/demo/Makefile
 components/ido_mysql/Makefile
@@ -141,7 +142,6 @@ lib/config/Makefile
 lib/icinga/Makefile
 lib/ido/Makefile
 lib/python/Makefile
-lib/remoting/Makefile
 test/Makefile
 third-party/Makefile
 third-party/cJSON/Makefile
index 0a2ac331f36a1c1b431e64e6f94bdf2f8b61a8a4..4e16a5d37f4c63a4ac1b76e14ae17ea5ef70476e 100644 (file)
@@ -1,8 +1,8 @@
 -----BEGIN CERTIFICATE-----
 MIICtzCCAiCgAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJERTEQ
 MA4GA1UECAwHQmF2YXJpYTESMBAGA1UEBwwJTnVyZW1iZXJnMRUwEwYDVQQKDAxO
-RVRXQVlTIEdtYkgxHDAaBgNVBAMME0ljaW5nYSBTbmFrZSBPaWwgQ0EwHhcNMTIw
-NDI0MTE0NzQ2WhcNMTMwNDI0MTE0NzQ2WjBeMQswCQYDVQQGEwJERTEQMA4GA1UE
+RVRXQVlTIEdtYkgxHDAaBgNVBAMME0ljaW5nYSBTbmFrZSBPaWwgQ0EwHhcNMTMw
+ODI3MDcyNTE0WhcNMjMwODI1MDcyNTE0WjBeMQswCQYDVQQGEwJERTEQMA4GA1UE
 CAwHQmF2YXJpYTESMBAGA1UEBwwJTnVyZW1iZXJnMRUwEwYDVQQKDAxORVRXQVlT
 IEdtYkgxEjAQBgNVBAMMCWljaW5nYS1jMTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
 gYkCgYEAysHrzHs9WfQR4cEUx2hFZQmbM+Ssi5L63yqnzxEvVQ3GlM+uIceK1Kvx
@@ -10,10 +10,10 @@ gYkCgYEAysHrzHs9WfQR4cEUx2hFZQmbM+Ssi5L63yqnzxEvVQ3GlM+uIceK1Kvx
 CP3s5yC7ZZ6bDiPMhRi/TRvY6+uQf+yew5daA3p87jocgRjhRicCAwEAAaN7MHkw
 CQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2Vy
 dGlmaWNhdGUwHQYDVR0OBBYEFPzsYbQZdbq+pcFJWoenWREW6WhMMB8GA1UdIwQY
-MBaAFNVJHVPJNwqEcG51lpqZJWVPaysFMA0GCSqGSIb3DQEBBQUAA4GBAMLP1GJf
-0hFdrEpGq+NvxTVx7wD30enAot5x2HLx4HuFohQJz/VZ45v+srrA+HEXbBFXPOd4
-nB2XtcDDidFKTt5E03HBwDGGZvnB3f1KXYi7B50imKrwVVzgp5nGBM4hSzWGovEX
-EYofmhk0fQg9qiKQrjwNib/4/b0srwEswfdj
+MBaAFNVJHVPJNwqEcG51lpqZJWVPaysFMA0GCSqGSIb3DQEBBQUAA4GBAKYB6Cds
+jJh20DMXKXklftqNPiGcPjnwpka5u/ys//rkgzjYnLiE9jkP5d32JtQbEqUY9gqN
+Ngu2HeHE4hGrbgvCj0aPepzJY3RvxIJwvX7nuKHjSitKwOsQYsOkTjTfOyhI8kSN
+nOGsDr4xpMX/iJL3Q1O9MwVRseKF8s9U+zjV
 -----END CERTIFICATE-----
 -----BEGIN PRIVATE KEY-----
 MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMrB68x7PVn0EeHB
@@ -30,4 +30,4 @@ WLEQa8UZ5enQeOcKCTudgn7fWIUxAkEAmXWfXP6YZXVzvR+xt08225aEvTItEbKM
 krFJNlLe4aNb1Hp6lO5ALnk6vDq8wSKZqGIFHBtq6vHNZFiix+xO8QJAIZ3pB/Bz
 Il8NjZMg8t/1sJdn32Xe9D0lZRtZTKC8zF/78NDFEo9qqE4Sr1CUfqlx18HXOxCO
 Vg4lv6+jUj+LmA==
------END PRIVATE KEY-----
\ No newline at end of file
+-----END PRIVATE KEY-----
index c7a50fe5ae9e6d6fc9be8cd9bb1517da0f59b461..ea7a8913d69076e3b8f7bf4ae256f54262763ec2 100644 (file)
@@ -1,8 +1,8 @@
 -----BEGIN CERTIFICATE-----
 MIICtzCCAiCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJERTEQ
 MA4GA1UECAwHQmF2YXJpYTESMBAGA1UEBwwJTnVyZW1iZXJnMRUwEwYDVQQKDAxO
-RVRXQVlTIEdtYkgxHDAaBgNVBAMME0ljaW5nYSBTbmFrZSBPaWwgQ0EwHhcNMTIw
-NDI0MTE0NzU1WhcNMTMwNDI0MTE0NzU1WjBeMQswCQYDVQQGEwJERTEQMA4GA1UE
+RVRXQVlTIEdtYkgxHDAaBgNVBAMME0ljaW5nYSBTbmFrZSBPaWwgQ0EwHhcNMTMw
+ODI3MDcyNTQwWhcNMjMwODI1MDcyNTQwWjBeMQswCQYDVQQGEwJERTEQMA4GA1UE
 CAwHQmF2YXJpYTESMBAGA1UEBwwJTnVyZW1iZXJnMRUwEwYDVQQKDAxORVRXQVlT
 IEdtYkgxEjAQBgNVBAMMCWljaW5nYS1jMjCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
 gYkCgYEArOcVui1AWojbPuK/7We9uwIBLaOLfBxQRI3+k6PzzjdtaXT4ijT/DSav
@@ -10,10 +10,10 @@ Q5U4wGOLYh0yuSyqS88QX/DsqDGLXnSVs8mT37bioMOw2XinqaNQ6xK4vyi0FYxS
 ewI6YOkYi7135NEaSUgd82hk4wFtiIb67T7hkHRc7Aui6FmT/SkCAwEAAaN7MHkw
 CQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2Vy
 dGlmaWNhdGUwHQYDVR0OBBYEFGvpolD5na6L70kNFO1tYGYIwDhqMB8GA1UdIwQY
-MBaAFNVJHVPJNwqEcG51lpqZJWVPaysFMA0GCSqGSIb3DQEBBQUAA4GBAIhhjKWw
-5JKirNidgG9PuD8x47VsRTkESLlq/pS7KjkE1nWCG9JpR5oVSzx2WXomiaAZ4q2C
-WS1z4HD9HF4NbhY+xVBi0Fj/kotuXCCweRo5EVp7Q4fabm1maJemFwMTHGhBLu7a
-v4dquYyOk9Dhkwcjajyn+KWceCoUTdI3LB2t
+MBaAFNVJHVPJNwqEcG51lpqZJWVPaysFMA0GCSqGSIb3DQEBBQUAA4GBAFLLI1Il
+q6SRYcsFGHw+mAA2Uw1ySAlpDQUS6GFcWjMKTaIMgzBDBVJixo8TsuajURXUlDsh
+mKqpHdOsl5zU/KZHufn5sI1QrDTrUPMt8PqCqwmEoykgbbbxl/913HJ5XKDyzL/p
+Pq8b9sMlI601pOQGFI939WueGgfOc4WRdlMS
 -----END CERTIFICATE-----
 -----BEGIN PRIVATE KEY-----
 MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKznFbotQFqI2z7i
index dfa78a92c6a7112224685322b95152a1a228df06..350879daa4da221d57e24d2f4ddd49f6df2b33b2 100644 (file)
@@ -1,16 +1,19 @@
 -----BEGIN CERTIFICATE-----
-MIICNTCCAZ4CAQQwDQYJKoZIhvcNAQEFBQAwaDELMAkGA1UEBhMCREUxEDAOBgNV
-BAgMB0JhdmFyaWExEjAQBgNVBAcMCU51cmVtYmVyZzEVMBMGA1UECgwMTkVUV0FZ
-UyBHbWJIMRwwGgYDVQQDDBNJY2luZ2EgU25ha2UgT2lsIENBMB4XDTEyMDUwODA3
-MzkxOVoXDTIyMDUwNjA3MzkxOVowXjELMAkGA1UEBhMCREUxEDAOBgNVBAgMB0Jh
-dmFyaWExEjAQBgNVBAcMCU51cmVtYmVyZzEVMBMGA1UECgwMTkVUV0FZUyBHbWJI
-MRIwEAYDVQQDDAlpY2luZ2EtYzMwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB
-AKFf+UkCgbNtEP0OoeF+K02L5SRlqkkkp6eaieh0IN7NNAxeELcGpZmycv4sHp30
-qv0zDtKU1HYrpm8TEBsz2AoT+J36QT9IysfcWdM9o3WZGMDUVqYBUscurkxBQJCK
-cFwXijTJ8Djn82xVgNUm/E44AdbrIwUlx23yllErx8hfAgMBAAEwDQYJKoZIhvcN
-AQEFBQADgYEAsZOKZQ2+ksPiNTCJrY+uiUZs6lFSbcJ9BHHaAt0ytQPiblufz3xl
-AR5Hza5fHt+lN9aGxM7TWMhjZHhmoctSRz8AW1KZTdbxJhRdbqmBjl95c2wBiDxs
-ERpyU9m9Rp42IjTyU4Vr/yO7DgMcG2k4KYzNquA5O8rqqtPRAp3H6n0=
+MIICtzCCAiCgAwIBAgIBAjANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJERTEQ
+MA4GA1UECAwHQmF2YXJpYTESMBAGA1UEBwwJTnVyZW1iZXJnMRUwEwYDVQQKDAxO
+RVRXQVlTIEdtYkgxHDAaBgNVBAMME0ljaW5nYSBTbmFrZSBPaWwgQ0EwHhcNMTMw
+ODI3MDcyNTQ1WhcNMjMwODI1MDcyNTQ1WjBeMQswCQYDVQQGEwJERTEQMA4GA1UE
+CAwHQmF2YXJpYTESMBAGA1UEBwwJTnVyZW1iZXJnMRUwEwYDVQQKDAxORVRXQVlT
+IEdtYkgxEjAQBgNVBAMMCWljaW5nYS1jMzCBnzANBgkqhkiG9w0BAQEFAAOBjQAw
+gYkCgYEAoV/5SQKBs20Q/Q6h4X4rTYvlJGWqSSSnp5qJ6HQg3s00DF4QtwalmbJy
+/iwenfSq/TMO0pTUdiumbxMQGzPYChP4nfpBP0jKx9xZ0z2jdZkYwNRWpgFSxy6u
+TEFAkIpwXBeKNMnwOOfzbFWA1Sb8TjgB1usjBSXHbfKWUSvHyF8CAwEAAaN7MHkw
+CQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2Vy
+dGlmaWNhdGUwHQYDVR0OBBYEFEwxDpbbnj9CAJRPErpolPAjAi1bMB8GA1UdIwQY
+MBaAFNVJHVPJNwqEcG51lpqZJWVPaysFMA0GCSqGSIb3DQEBBQUAA4GBAJMvQyvv
+aXxu87au/X6+k6ghUImwGW/xqtrouyVZ3yX4zq9R/sZ1yA5jRq7e+IDjb04qraY7
+ZwMCWqjUYFUzV4ViEx6m7bnm/Qv+pubmM7v8B4Obm1HJniVcJUMOzoGgKGQxjOCt
+97EsiVQZGnss4PYjjxlW7T/QvqkZb4tbyyeE
 -----END CERTIFICATE-----
 -----BEGIN RSA PRIVATE KEY-----
 MIICXAIBAAKBgQChX/lJAoGzbRD9DqHhfitNi+UkZapJJKenmonodCDezTQMXhC3
index cfef4d186fcfc6f3a0e18e92493befff945a145f..e71ddba602995e129a04f1477ce52dffc2121a92 100644 (file)
@@ -26,19 +26,24 @@ class IcingaValuePrinter:
         else:
             return '<INVALID>'
 
-class IcingaAttributePrinter:
+class IcingaSignalPrinter:
     def __init__(self, val):
         self.val = val
 
     def to_string(self):
-        return self.val['m_Value']
+        return '<SIGNAL>'
 
-class IcingaSignalPrinter:
+class IcingaMutexPrinter:
     def __init__(self, val):
-        self.val = val
+      self.val = val
 
     def to_string(self):
-        return '<SIGNAL>'
+      owner = self.val['__data']['__owner']
+
+      if owner == 0:
+          return '<unlocked>'
+      else:
+          return '<locked by #' + owner + '>'
 
 def lookup_icinga_type(val):
     t = val.type.unqualified()
@@ -46,10 +51,10 @@ def lookup_icinga_type(val):
         return IcingaStringPrinter(val)
     elif str(t) == 'icinga::Value':
         return IcingaValuePrinter(val)
-    elif str(t) == 'icinga::AttributeBase' or re.match('^icinga::Attribute<.*>$', str(t)):
-        return IcingaAttributePrinter(val)
     elif re.match('^boost::signals2::signal.*<.*>$', str(t)):
         return IcingaSignalPrinter(val)
+    elif str(t) == 'pthread_mutex_t':
+        return IcingaMutexPrinter(val)
 
     return None
 
index 4a5ece41c24f17c23c684f18aad3f5c336f97e01..d8e8945f6012c4e05205b4936e62bae025b67ee0 100644 (file)
@@ -4,7 +4,6 @@
 SUBDIRS = \
        base \
        config \
-       remoting \
        icinga \
        ido \
        python
index 575c10c2ec1fbb0e77ebb6a6c866fde8d7ebb8e1..043f89ba1ada1d942e493c38df5bf137656d1e88 100644 (file)
 
 using namespace icinga;
 
-/**
- * Constructor for the Array class.
- */
-Array::Array(void)
-       : m_Sealed(false)
-{ }
-
 /**
  * Restrieves a value from an array.
  *
@@ -58,9 +51,6 @@ void Array::Set(unsigned int index, const Value& value)
        ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
-       if (m_Sealed)
-               BOOST_THROW_EXCEPTION(std::invalid_argument("Array must not be sealed."));
-
        m_Data.at(index) = value;
 }
 
@@ -74,9 +64,6 @@ void Array::Add(const Value& value)
        ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
-       if (m_Sealed)
-               BOOST_THROW_EXCEPTION(std::invalid_argument("Array must not be sealed."));
-
        m_Data.push_back(value);
 }
 
@@ -131,9 +118,6 @@ void Array::Remove(unsigned int index)
        ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
-       if (m_Sealed)
-               BOOST_THROW_EXCEPTION(std::invalid_argument("Array must not be sealed."));
-
        m_Data.erase(m_Data.begin() + index);
 }
 
@@ -146,37 +130,9 @@ void Array::Remove(Array::Iterator it)
 {
        ASSERT(OwnsLock());
 
-       if (m_Sealed)
-               BOOST_THROW_EXCEPTION(std::invalid_argument("Array must not be sealed."));
-
        m_Data.erase(it);
 }
 
-/**
- * Marks the array as read-only. Attempting to modify a sealed
- * array is an error.
- */
-void Array::Seal(void)
-{
-       ASSERT(!OwnsLock());
-       ObjectLock olock(this);
-
-       m_Sealed = true;
-}
-
-/**
- * Checks whether the array is sealed.
- *
- * @returns true if the array is sealed, false otherwise.
- */
-bool Array::IsSealed(void) const
-{
-       ASSERT(!OwnsLock());
-       ObjectLock olock(this);
-
-       return m_Sealed;
-}
-
 /**
  * Makes a shallow copy of an array.
  *
index fe96093003286b703bb6d4f618e41bd9ff162f4f..cd1656033aef8f77696229d91b6b2572495c2c45 100644 (file)
@@ -42,15 +42,10 @@ public:
         */
        typedef std::vector<Value>::iterator Iterator;
 
-       Array(void);
-
        Value Get(unsigned int index) const;
        void Set(unsigned int index, const Value& value);
        void Add(const Value& value);
 
-       void Seal(void);
-       bool IsSealed(void) const;
-
        Iterator Begin(void);
        Iterator End(void);
 
@@ -66,7 +61,6 @@ public:
 
 private:
        std::vector<Value> m_Data; /**< The data for the array. */
-       bool m_Sealed; /**< Whether the array is read-only. */
 };
 
 inline Array::Iterator range_begin(Array::Ptr x)
index b9346279e39454173776887c6b7c7be11ded0153..2f35a57f3c75d3a5a9d6c99f2ee2ad0d9261421f 100644 (file)
@@ -27,7 +27,7 @@
 using namespace icinga;
 
 BufferedStream::BufferedStream(const Stream::Ptr& innerStream)
-       : m_InnerStream(innerStream), m_Stopped(false),
+       : m_InnerStream(innerStream), m_Stopped(false), m_Eof(false),
          m_RecvQ(boost::make_shared<FIFO>()), m_SendQ(boost::make_shared<FIFO>()),
          m_Blocking(true), m_Exception()
 {
@@ -64,8 +64,15 @@ void BufferedStream::ReadThreadProc(void)
                for (;;) {
                        size_t rc = m_InnerStream->Read(buffer, sizeof(buffer));
 
-                       if (rc == 0)
+                       if (rc == 0) {
+                               boost::mutex::scoped_lock lock(m_Mutex);
+                               m_Eof = true;
+                               m_Stopped = true;
+                               m_ReadCV.notify_all();
+                               m_WriteCV.notify_all();
+
                                break;
+                       }
 
                        boost::mutex::scoped_lock lock(m_Mutex);
                        m_RecvQ->Write(buffer, rc);
@@ -173,7 +180,7 @@ void BufferedStream::WaitReadable(size_t count)
 
 void BufferedStream::InternalWaitReadable(size_t count, boost::mutex::scoped_lock& lock)
 {
-       while (m_RecvQ->GetAvailableBytes() < count && !m_Exception)
+       while (m_RecvQ->GetAvailableBytes() < count && !m_Exception && !m_Stopped)
                m_ReadCV.wait(lock);
 }
 
@@ -186,3 +193,10 @@ void BufferedStream::MakeNonBlocking(void)
 
        m_Blocking = false;
 }
+
+bool BufferedStream::IsEof(void) const
+{
+       boost::mutex::scoped_lock lock(m_Mutex);
+
+       return m_Eof;
+}
\ No newline at end of file
index 75934f553fbe2aaca8b3a875de485053bc6c2dd1..a6028f3c969a9ce8f86514c24c3e31e522ad3d40 100644 (file)
@@ -45,6 +45,8 @@ public:
 
        virtual void Close(void);
 
+       virtual bool IsEof(void) const;
+
        void WaitReadable(size_t count);
        void WaitWritable(size_t count);
 
@@ -54,6 +56,7 @@ private:
        Stream::Ptr m_InnerStream;
 
        bool m_Stopped;
+       bool m_Eof;
 
        FIFO::Ptr m_RecvQ;
        FIFO::Ptr m_SendQ;
@@ -62,7 +65,7 @@ private:
 
        boost::exception_ptr m_Exception;
 
-       boost::mutex m_Mutex;
+       mutable boost::mutex m_Mutex;
        boost::condition_variable m_ReadCV;
        boost::condition_variable m_WriteCV;
 
index d5914a596ef2228220db554106ac6430e59dcdff..1c8773d2d011732036b2085d46f0b17bb197d6da 100644 (file)
@@ -59,13 +59,6 @@ struct DictionaryKeyLessComparer
        }
 };
 
-/**
- * Constructor for the Dictionary class.
- */
-Dictionary::Dictionary(void)
-       : m_Sealed(false)
-{ }
-
 /**
  * Restrieves a value from a dictionary.
  *
@@ -114,9 +107,6 @@ void Dictionary::Set(const String& key, const Value& value)
        ASSERT(!OwnsLock());
        ObjectLock olock(this);
 
-       if (m_Sealed)
-               BOOST_THROW_EXCEPTION(std::invalid_argument("Dictionary must not be sealed."));
-
        std::pair<std::map<String, Value>::iterator, bool> ret;
        ret = m_Data.insert(std::make_pair(key, value));
        if (!ret.second)
@@ -194,9 +184,6 @@ void Dictionary::Remove(const String& key)
        if (it == m_Data.end())
                return;
 
-       if (m_Sealed)
-               BOOST_THROW_EXCEPTION(std::invalid_argument("Dictionary must not be sealed."));
-
        m_Data.erase(it);
 }
 
@@ -209,37 +196,9 @@ void Dictionary::Remove(Dictionary::Iterator it)
 {
        ASSERT(OwnsLock());
 
-       if (m_Sealed)
-               BOOST_THROW_EXCEPTION(std::invalid_argument("Dictionary must not be sealed."));
-
        m_Data.erase(it);
 }
 
-/**
- * Marks the dictionary as read-only. Attempting to modify a sealed
- * dictionary is an error.
- */
-void Dictionary::Seal(void)
-{
-       ASSERT(!OwnsLock());
-       ObjectLock olock(this);
-
-       m_Sealed = true;
-}
-
-/**
- * Checks whether the dictionary is sealed.
- *
- * @returns true if the dictionary is sealed, false otherwise.
- */
-bool Dictionary::IsSealed(void) const
-{
-       ASSERT(!OwnsLock());
-       ObjectLock olock(this);
-
-       return m_Sealed;
-}
-
 /**
  * Makes a shallow copy of a dictionary.
  *
index 8f8e669c33f1233253b585632533b300d8c2c6ff..9331505eadb18b6f2cd9b06d795954e7c4d792ce 100644 (file)
@@ -43,16 +43,11 @@ public:
         */
        typedef std::map<String, Value>::iterator Iterator;
 
-       Dictionary(void);
-
        Value Get(const char *key) const;
        Value Get(const String& key) const;
        void Set(const String& key, const Value& value);
        bool Contains(const String& key) const;
 
-       void Seal(void);
-       bool IsSealed(void) const;
-
        Iterator Begin(void);
        Iterator End(void);
 
@@ -68,7 +63,6 @@ public:
 
 private:
        std::map<String, Value> m_Data; /**< The data for the dictionary. */
-       bool m_Sealed; /**< Whether the dictionary is read-only. */
 };
 
 inline Dictionary::Iterator range_begin(Dictionary::Ptr x)
index 73a5d40bad26df332c168b93974aeafbc7cf1582..485cb2fe77f83256a02c65db931da2855fd78198 100644 (file)
@@ -272,7 +272,7 @@ void DynamicObject::RestoreObjects(const String& filename, int attributeTypes)
                DynamicType::Ptr dt = DynamicType::GetByName(type);
 
                if (!dt)
-                       BOOST_THROW_EXCEPTION(std::invalid_argument("Invalid type: " + type));
+                       continue;
 
                DynamicObject::Ptr object = dt->GetObject(name);
 
index b908c784310c17a820d9d1f2830001c15c178157..6f968e48170821aaffc2680ccd965443cc7fed8c 100644 (file)
@@ -111,6 +111,11 @@ void FIFO::Write(const void *buffer, size_t count)
 void FIFO::Close(void)
 { }
 
+bool FIFO::IsEof(void) const
+{
+       return false;
+}
+
 size_t FIFO::GetAvailableBytes(void) const
 {
        return m_DataSize;
index cab32b160fe7452d3d1dd2fcb2d04bbb8435152e..d7d6ec88f9b7bd3e5e3d3fb9a3d0bcdd12ade617 100644 (file)
@@ -44,6 +44,7 @@ public:
        virtual size_t Read(void *buffer, size_t count);
        virtual void Write(const void *buffer, size_t count);
        virtual void Close(void);
+       virtual bool IsEof(void) const;
 
        size_t GetAvailableBytes(void) const;
 
index 9bc83a5ec452875bf5590f5d942bb8dd87aee1b0..4335a245afdf8486c5233bdf3314d5d98b9adce3 100644 (file)
@@ -25,7 +25,7 @@
 using namespace icinga;
 
 NetworkStream::NetworkStream(const Socket::Ptr& socket)
-       : m_Socket(socket)
+       : m_Socket(socket), m_Eof(false)
 { }
 
 void NetworkStream::Close(void)
@@ -43,7 +43,12 @@ void NetworkStream::Close(void)
  */
 size_t NetworkStream::Read(void *buffer, size_t count)
 {
-       return m_Socket->Read(buffer, count);
+       size_t rc = m_Socket->Read(buffer, count);
+
+       if (rc == 0)
+               m_Eof = true;
+
+       return rc;
 }
 
 /**
@@ -59,3 +64,8 @@ void NetworkStream::Write(const void *buffer, size_t count)
        if (rc < count)
                BOOST_THROW_EXCEPTION(std::runtime_error("Short write for socket."));
 }
+
+bool NetworkStream::IsEof(void) const
+{
+       return m_Eof;
+}
index 018f02f30964e8fa7cc0639979bdbbf642d12ffb..c98c1da4012f4f54c7d368f0085b44221a198307 100644 (file)
@@ -44,8 +44,11 @@ public:
 
        virtual void Close(void);
 
+       virtual bool IsEof(void) const;
+
 private:
        Socket::Ptr m_Socket;
+       bool m_Eof;
 };
 
 }
index ec4cf4d0c6bd056caecb9cd93ebcc60ef7b40102..777eb11934ae2cf627ab1f600de75d69b8c97cfd 100644 (file)
@@ -61,3 +61,8 @@ void StdioStream::Close(void)
                m_OwnsStream = false;
        }
 }
+
+bool StdioStream::IsEof(void) const
+{
+       return m_InnerStream->eof();
+}
index f1b9079f52090f5b09ceb20f33b35e98b7718983..96db5a92ea41fb1b84482656947c3538eb64d4be 100644 (file)
@@ -39,6 +39,8 @@ public:
 
        virtual void Close(void);
 
+       virtual bool IsEof(void) const;
+
 private:
        std::iostream *m_InnerStream;
        bool m_OwnsStream;
index 3f0fa5e0ca09ef96bb9f70f183a10dbbca43dbfb..10a2d3c006373b7780e0ed5451c869a95029e5e6 100644 (file)
@@ -74,6 +74,13 @@ public:
         */
        virtual void Close(void) = 0;
 
+       /**
+        * Checks whether we've reached the end-of-file condition.
+        *
+        * @returns true if EOF.
+        */
+       virtual bool IsEof(void) const = 0;
+
        bool ReadLine(String *line, ReadLineContext& context);
 };
 
index 324d0735e0522c9cf11c516065cc8996223d864c..07ca1f9fc81406970da20397b34e1262d7cfba94 100644 (file)
@@ -111,7 +111,7 @@ static int I2Stream_read(BIO *bi, char *out, int outl)
                return -1;
        }
 
-       if (data_read == 0) {
+       if (data_read == 0 && !bp->StreamObj->IsEof()) {
                BIO_set_retry_read(bi);
                return -1;
        }
index 5e727bb436080469d3e1b34320ec9e11c8a2d47a..ea20871dfac62c6dd04f386124855d11db38de40 100644 (file)
@@ -214,3 +214,8 @@ void TlsStream::Close(void)
 {
        m_InnerStream->Close();
 }
+
+bool TlsStream::IsEof(void) const
+{
+       return m_InnerStream->IsEof();
+}
index cd59ed51e2a6b640f159af43595f55362ff3da15..813044a445653784172ce212dae96dd4733b97da 100644 (file)
@@ -57,6 +57,8 @@ public:
        virtual size_t Read(void *buffer, size_t count);
        virtual void Write(const void *buffer, size_t count);
 
+       virtual bool IsEof(void) const;
+
 private:
        shared_ptr<SSL_CTX> m_SSLContext;
        shared_ptr<SSL> m_SSL;
index 7ea26928d9f5eceb65a5546109bf772114320f87..4f5381a4f6b1345c01512da2305039870d0c5d79 100644 (file)
@@ -179,8 +179,6 @@ DynamicObject::Ptr ConfigItem::Commit(void)
                }
        }
 
-       attrs->Seal();
-
        DynamicObject::Ptr dobj = dtype->CreateObject(attrs);
        dobj->Register();
 
index 0472df905cb8d56578ee4f590ccf0d9308f528ff..62a378601f09cf4d35959167d6424f5fb491b14e 100644 (file)
@@ -88,5 +88,4 @@ libicinga_la_LIBADD = \
        $(BOOST_THREAD_LIB) \
        $(BOOST_SYSTEM_LIB) \
        ${top_builddir}/lib/base/libbase.la \
-       ${top_builddir}/lib/config/libconfig.la \
-       ${top_builddir}/lib/remoting/libremoting.la
+       ${top_builddir}/lib/config/libconfig.la
index ee151326520232cbcf0a4a85b6f57b53ec0da15d..63b5a10799bb675ea6a296e5cf2104c34acfbce5 100644 (file)
@@ -183,10 +183,6 @@ type HostGroup {
 }
 
 type IcingaApplication {
-       %attribute string "cert_path",
-       %attribute string "ca_path",
-       %attribute string "node",
-       %attribute string "service",
        %attribute string "pid_path",
        %attribute string "state_path",
        %attribute dictionary "macros" {
index 919bd12d35fcfe7e0dd55628a39ac0511bda281c..6166d574a314473c842bfdbed993324dfe93f968 100644 (file)
@@ -18,7 +18,6 @@
  ******************************************************************************/
 
 #include "icinga/icingaapplication.h"
-#include "remoting/endpointmanager.h"
 #include "base/dynamictype.h"
 #include "base/logger_fwd.h"
 #include "base/objectlock.h"
@@ -50,22 +49,6 @@ int IcingaApplication::Main(void)
 
        UpdatePidFile(GetPidPath());
 
-       if (!GetCertificateFile().IsEmpty() && !GetCAFile().IsEmpty()) {
-               /* set up SSL context */
-               shared_ptr<X509> cert = GetX509Certificate(GetCertificateFile());
-               String identity = GetCertificateCN(cert);
-               Log(LogInformation, "icinga", "My identity: " + identity);
-               EndpointManager::GetInstance()->SetIdentity(identity);
-
-               m_SSLContext = MakeSSLContext(GetCertificateFile(), GetCertificateFile(), GetCAFile());
-
-               EndpointManager::GetInstance()->SetSSLContext(m_SSLContext);
-       }
-
-       /* create the primary RPC listener */
-       if (!GetService().IsEmpty())
-               EndpointManager::GetInstance()->AddListener(GetService());
-
        /* restore the previous program state */
        DynamicObject::RestoreObjects(GetStatePath());
 
@@ -104,34 +87,6 @@ IcingaApplication::Ptr IcingaApplication::GetInstance(void)
        return static_pointer_cast<IcingaApplication>(Application::GetInstance());
 }
 
-String IcingaApplication::GetCertificateFile(void) const
-{
-       ObjectLock olock(this);
-
-       return m_CertPath;
-}
-
-String IcingaApplication::GetCAFile(void) const
-{
-       ObjectLock olock(this);
-
-       return m_CAPath;
-}
-
-String IcingaApplication::GetNode(void) const
-{
-       ObjectLock olock(this);
-
-       return m_Node;
-}
-
-String IcingaApplication::GetService(void) const
-{
-       ObjectLock olock(this);
-
-       return m_Service;
-}
-
 String IcingaApplication::GetPidPath(void) const
 {
        ObjectLock olock(this);
@@ -146,10 +101,10 @@ String IcingaApplication::GetStatePath(void) const
 {
        ObjectLock olock(this);
 
-       if (m_PidPath.IsEmpty())
+       if (m_StatePath.IsEmpty())
                return Application::GetLocalStateDir() + "/lib/icinga2/icinga2.state";
        else
-               return m_PidPath;
+               return m_StatePath;
 }
 
 Dictionary::Ptr IcingaApplication::GetMacros(void) const
@@ -166,13 +121,6 @@ double IcingaApplication::GetStartTime(void) const
        return m_StartTime;
 }
 
-shared_ptr<SSL_CTX> IcingaApplication::GetSSLContext(void) const
-{
-       ObjectLock olock(this);
-
-       return m_SSLContext;
-}
-
 bool IcingaApplication::ResolveMacro(const String& macro, const Dictionary::Ptr&, String *result) const
 {
        double now = Utility::GetTime();
@@ -209,10 +157,6 @@ void IcingaApplication::InternalSerialize(const Dictionary::Ptr& bag, int attrib
        DynamicObject::InternalSerialize(bag, attributeTypes);
 
        if (attributeTypes & Attribute_Config) {
-               bag->Set("cert_path", m_CertPath);
-               bag->Set("ca_path", m_CAPath);
-               bag->Set("node", m_Node);
-               bag->Set("service", m_Service);
                bag->Set("pid_path", m_PidPath);
                bag->Set("state_path", m_StatePath);
                bag->Set("macros", m_Macros);
@@ -224,10 +168,6 @@ void IcingaApplication::InternalDeserialize(const Dictionary::Ptr& bag, int attr
        DynamicObject::InternalDeserialize(bag, attributeTypes);
 
        if (attributeTypes & Attribute_Config) {
-               m_CertPath = bag->Get("cert_path");
-               m_CAPath = bag->Get("ca_path");
-               m_Node = bag->Get("node");
-               m_Service = bag->Get("service");
                m_PidPath = bag->Get("pid_path");
                m_StatePath = bag->Get("state_path");
                m_Macros = bag->Get("macros");
index daedadc04cbaab7b64f9d14aff92916c12791e47..c0795ac9e85477051fce129835923a47ac8fa28f 100644 (file)
@@ -23,7 +23,6 @@
 #include "icinga/i2-icinga.h"
 #include "icinga/macroresolver.h"
 #include "base/application.h"
-#include "base/tlsutility.h"
 
 namespace icinga
 {
@@ -43,14 +42,9 @@ public:
 
        static IcingaApplication::Ptr GetInstance(void);
 
-       String GetCertificateFile(void) const;
-       String GetCAFile(void) const;
-       String GetNode(void) const;
-       String GetService(void) const;
        String GetPidPath(void) const;
        String GetStatePath(void) const;
        Dictionary::Ptr GetMacros(void) const;
-       shared_ptr<SSL_CTX> GetSSLContext(void) const;
 
        double GetStartTime(void) const;
 
@@ -61,16 +55,10 @@ protected:
        virtual void InternalDeserialize(const Dictionary::Ptr& bag, int attributeTypes);
 
 private:
-       String m_CertPath;
-       String m_CAPath;
-       String m_Node;
-       String m_Service;
        String m_PidPath;
        String m_StatePath;
        Dictionary::Ptr m_Macros;
 
-       shared_ptr<SSL_CTX> m_SSLContext;
-
        double m_StartTime;
 
        void DumpProgramState(void);
index 4d8069ffcca8d3e675782afb503ccbfde37fa32a..a8370c53e94e06c88512033253a0e8dd9db828ea 100644 (file)
@@ -21,7 +21,6 @@
 #include "icinga/notificationcommand.h"
 #include "icinga/macroprocessor.h"
 #include "icinga/service.h"
-#include "remoting/endpointmanager.h"
 #include "base/dynamictype.h"
 #include "base/objectlock.h"
 #include "base/logger_fwd.h"
index db2cd643b34fb630e59298440140a8ac7165c511..6c01126262df1738dc2c1d65cfd75cf3e557709a 100644 (file)
@@ -590,8 +590,6 @@ void Service::ProcessCheckResult(const Dictionary::Ptr& cr)
 
        cr->Set("vars_after", vars_after);
 
-       cr->Seal();
-
        olock.Lock();
        SetLastCheckResult(cr);
 
@@ -749,7 +747,6 @@ void Service::ExecuteCheck(void)
 
        checkInfo->Set("execution_end", Utility::GetTime());
        checkInfo->Set("schedule_end", Utility::GetTime());
-       checkInfo->Seal();
 
        if (result) {
                if (!result->Contains("schedule_start"))
index e26f8d6118537d96e37dfdc5cc7142ba5a0b506b..b9057a7ec504251ca8460c215219777e15fec49c 100644 (file)
@@ -57,5 +57,4 @@ libido_la_LIBADD = \
        $(BOOST_SYSTEM_LIB) \
        ${top_builddir}/lib/base/libbase.la \
        ${top_builddir}/lib/config/libconfig.la \
-       ${top_builddir}/lib/remoting/libremoting.la \
        ${top_builddir}/lib/icinga/libicinga.la
index 15fc347b3caae414f84888089ea5d0c1d0ca2970..0f79fb0dfdbaa4976a69789501d58c3fd67ab585 100644 (file)
@@ -27,6 +27,5 @@ libpython_la_LDFLAGS = \
 libpython_la_LIBADD = \
        $(BOOST_THREAD_LIB) \
        ${top_builddir}/lib/base/libbase.la \
-       ${top_builddir}/lib/config/libconfig.la \
-       ${top_builddir}/lib/remoting/libremoting.la
+       ${top_builddir}/lib/config/libconfig.la
 endif
diff --git a/lib/remoting/.gitignore b/lib/remoting/.gitignore
deleted file mode 100644 (file)
index 83eb6c9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-remoting-type.cpp
diff --git a/lib/remoting/endpointmanager.cpp b/lib/remoting/endpointmanager.cpp
deleted file mode 100644 (file)
index b41d974..0000000
+++ /dev/null
@@ -1,411 +0,0 @@
-/******************************************************************************
- * Icinga 2                                                                   *
- * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/)        *
- *                                                                            *
- * This program is free software; you can redistribute it and/or              *
- * modify it under the terms of the GNU General Public License                *
- * as published by the Free Software Foundation; either version 2             *
- * of the License, or (at your option) any later version.                     *
- *                                                                            *
- * This program is distributed in the hope that it will be useful,            *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
- * GNU General Public License for more details.                               *
- *                                                                            *
- * You should have received a copy of the GNU General Public License          *
- * along with this program; if not, write to the Free Software Foundation     *
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
- ******************************************************************************/
-
-#include "remoting/endpointmanager.h"
-#include "base/dynamictype.h"
-#include "base/objectlock.h"
-#include "base/logger_fwd.h"
-#include "base/convert.h"
-#include "base/utility.h"
-#include "base/tlsutility.h"
-#include "base/networkstream.h"
-#include <boost/tuple/tuple.hpp>
-#include <boost/foreach.hpp>
-
-using namespace icinga;
-
-/**
- * Constructor for the EndpointManager class.
- */
-EndpointManager::EndpointManager(void)
-{
-       m_ReconnectTimer = boost::make_shared<Timer>();
-       m_ReconnectTimer->OnTimerExpired.connect(boost::bind(&EndpointManager::ReconnectTimerHandler, this));
-       m_ReconnectTimer->SetInterval(5);
-       m_ReconnectTimer->Start();
-}
-
-/**
- * Sets the SSL context.
- *
- * @param sslContext The new SSL context.
- */
-void EndpointManager::SetSSLContext(const shared_ptr<SSL_CTX>& sslContext)
-{
-       ObjectLock olock(this);
-
-       m_SSLContext = sslContext;
-}
-
-/**
- * Retrieves the SSL context.
- *
- * @returns The SSL context.
- */
-shared_ptr<SSL_CTX> EndpointManager::GetSSLContext(void) const
-{
-       ObjectLock olock(this);
-
-       return m_SSLContext;
-}
-
-/**
- * Sets the identity of the endpoint manager. This identity is used when
- * connecting to remote peers.
- *
- * @param identity The new identity.
- */
-void EndpointManager::SetIdentity(const String& identity)
-{
-       ObjectLock olock(this);
-
-       m_Identity = identity;
-}
-
-/**
- * Retrieves the identity for the endpoint manager.
- *
- * @returns The identity.
- */
-String EndpointManager::GetIdentity(void) const
-{
-       ObjectLock olock(this);
-
-       return m_Identity;
-}
-
-/**
- * Creates a new JSON-RPC listener on the specified port.
- *
- * @param service The port to listen on.
- */
-void EndpointManager::AddListener(const String& service)
-{
-       ObjectLock olock(this);
-
-       shared_ptr<SSL_CTX> sslContext = m_SSLContext;
-
-       if (!sslContext)
-               BOOST_THROW_EXCEPTION(std::logic_error("SSL context is required for AddListener()"));
-
-       std::ostringstream s;
-       s << "Adding new listener: port " << service;
-       Log(LogInformation, "icinga", s.str());
-
-       TcpSocket::Ptr server = boost::make_shared<TcpSocket>();
-       server->Bind(service, AF_INET6);
-
-       boost::thread thread(boost::bind(&EndpointManager::ListenerThreadProc, this, server));
-       thread.detach();
-
-       m_Servers.insert(server);
-}
-
-void EndpointManager::ListenerThreadProc(const Socket::Ptr& server)
-{
-       server->Listen();
-
-       for (;;) {
-               Socket::Ptr client = server->Accept();
-
-               try {
-                       NewClientHandler(client, TlsRoleServer);
-               } catch (const std::exception& ex) {
-                       std::stringstream message;
-                       message << "Error for new JSON-RPC socket: " << boost::diagnostic_information(ex);
-                       Log(LogInformation, "remoting", message.str());
-               }
-       }
-}
-
-/**
- * Creates a new JSON-RPC client and connects to the specified host and port.
- *
- * @param node The remote host.
- * @param service The remote port.
- */
-void EndpointManager::AddConnection(const String& node, const String& service) {
-       {
-               ObjectLock olock(this);
-
-               shared_ptr<SSL_CTX> sslContext = m_SSLContext;
-
-               if (!sslContext)
-                       BOOST_THROW_EXCEPTION(std::logic_error("SSL context is required for AddConnection()"));
-       }
-
-       TcpSocket::Ptr client = boost::make_shared<TcpSocket>();
-
-       try {
-               client->Connect(node, service);
-               NewClientHandler(client, TlsRoleClient);
-       } catch (const std::exception& ex) {
-               Log(LogInformation, "remoting", "Could not connect to " + node + ":" + service + ": " + ex.what());
-       }
-}
-
-/**
- * Processes a new client connection.
- *
- * @param client The new client.
- */
-void EndpointManager::NewClientHandler(const Socket::Ptr& client, TlsRole role)
-{
-       NetworkStream::Ptr netStream = boost::make_shared<NetworkStream>(client);
-
-       TlsStream::Ptr tlsStream = boost::make_shared<TlsStream>(netStream, role, m_SSLContext);
-       tlsStream->Handshake();
-
-       shared_ptr<X509> cert = tlsStream->GetPeerCertificate();
-       String identity = GetCertificateCN(cert);
-
-       Log(LogInformation, "icinga", "New client connection for identity '" + identity + "'");
-
-       Endpoint::Ptr endpoint = Endpoint::GetByName(identity);
-
-       if (!endpoint) {
-               Log(LogInformation, "remoting", "Closing endpoint '" + identity + "': No configuration available.");
-               return;
-       }
-
-       endpoint->SetClient(tlsStream);
-}
-
-///**
-// * Sends an anonymous unicast message to the specified recipient.
-// *
-// * @param recipient The recipient of the message.
-// * @param message The message.
-// */
-//void EndpointManager::SendUnicastMessage(const Endpoint::Ptr& recipient,
-//    const MessagePart& message)
-//{
-//     SendUnicastMessage(Endpoint::Ptr(), recipient, message);
-//}
-
-///**
-// * Sends a unicast message to the specified recipient.
-// *
-// * @param sender The sender of the message.
-// * @param recipient The recipient of the message.
-// * @param message The message.
-// */
-//void EndpointManager::SendUnicastMessage(const Endpoint::Ptr& sender,
-//    const Endpoint::Ptr& recipient, const MessagePart& message)
-//{
-//     /* don't forward messages between non-local endpoints, assume that
-//      * anonymous senders (sender == null) are local */
-////   if ((sender && !sender->IsLocal()) && !recipient->IsLocal())
-////           return;
-//
-//     if (ResponseMessage::IsResponseMessage(message))
-//             recipient->ProcessResponse(sender, message);
-//     else
-//             recipient->ProcessRequest(sender, message);
-//}
-
-///**
-// * Sends a message to exactly one recipient out of all recipients who have a
-// * subscription for the message's topic.
-// *
-// * @param sender The sender of the message.
-// * @param message The message.
-// */
-//void EndpointManager::SendAnycastMessage(const Endpoint::Ptr& sender,
-//    const RequestMessage& message)
-//{
-//     String method;
-//     if (!message.GetMethod(&method))
-//             BOOST_THROW_EXCEPTION(std::invalid_argument("Message is missing the 'method' property."));
-//
-//     std::vector<Endpoint::Ptr> candidates;
-//
-//     BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>()) {
-//             /* don't forward messages between non-local endpoints */
-////           if ((sender && !sender->IsLocal()) && !endpoint->IsLocal())
-////                   continue;
-//
-//             if (endpoint->HasSubscription(method))
-//                     candidates.push_back(endpoint);
-//     }
-//
-//     if (candidates.empty())
-//             return;
-//
-//     Endpoint::Ptr recipient = candidates[rand() % candidates.size()];
-//     SendUnicastMessage(sender, recipient, message);
-//}
-
-///**
-// * Sends an anonymous message to all recipients who have a subscription for the
-// * message's topic.
-// *
-// * @param message The message.
-// */
-//void EndpointManager::SendMulticastMessage(const RequestMessage& message)
-//{
-//     SendMulticastMessage(Endpoint::Ptr(), message);
-//}
-
-///**
-// * Sends a message to all recipients who have a subscription for the
-// * message's topic.
-// *
-// * @param sender The sender of the message.
-// * @param message The message.
-// */
-//void EndpointManager::SendBroadcastMessage(const Endpoint::Ptr& sender,
-//    const RequestMessage& message)
-//{
-//     String method;
-//     if (!message.GetMethod(&method))
-//             BOOST_THROW_EXCEPTION(std::invalid_argument("Message is missing the 'method' property."));
-//
-//     BOOST_FOREACH(const Endpoint::Ptr& recipient, DynamicType::GetObjects<Endpoint>()) {
-//             /* don't forward messages back to the sender */
-//             if (sender == recipient)
-//                     continue;
-//
-//             Log(LogDebug, "remoting", "Send multicast message using method " + method);
-//             if (recipient->HasSubscription(method))
-//                     SendUnicastMessage(sender, recipient, message);
-//     }
-//}
-
-//void EndpointManager::SendAPIMessage(const Endpoint::Ptr& sender, const Endpoint::Ptr& recipient,
-//    RequestMessage& message,
-//    const EndpointManager::APICallback& callback, double timeout)
-//{
-//     ObjectLock olock(this);
-//
-//     m_NextMessageID++;
-//
-//     String id = Convert::ToString(m_NextMessageID);
-//     message.SetID(id);
-//
-//     PendingRequest pr;
-//     pr.Request = message;
-//     pr.Callback = callback;
-//     pr.Timeout = Utility::GetTime() + timeout;
-//
-//     m_Requests[id] = pr;
-//
-//     if (!recipient)
-//             SendAnycastMessage(sender, message);
-//     else
-//             SendUnicastMessage(sender, recipient, message);
-//}
-//
-//bool EndpointManager::RequestTimeoutLessComparer(const std::pair<String, PendingRequest>& a,
-//    const std::pair<String, PendingRequest>& b)
-//{
-//     return a.second.Timeout < b.second.Timeout;
-//}
-//
-//void EndpointManager::SubscriptionTimerHandler(void)
-//{
-//     Dictionary::Ptr subscriptions = boost::make_shared<Dictionary>();
-//
-//     BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>()) {
-//             /* don't copy subscriptions from non-local endpoints or the identity endpoint */
-////           if (!endpoint->IsLocalEndpoint() || endpoint == m_Endpoint)
-////                   continue;
-//
-//             Dictionary::Ptr endpointSubscriptions = endpoint->GetSubscriptions();
-//
-//             if (endpointSubscriptions) {
-//                     ObjectLock olock(endpointSubscriptions);
-//
-//                     String topic;
-//                     BOOST_FOREACH(boost::tie(boost::tuples::ignore, topic), endpointSubscriptions) {
-//                             subscriptions->Set(topic, topic);
-//                     }
-//             }
-//     }
-//
-//     subscriptions->Seal();
-//
-//     if (m_Endpoint) {
-//             ObjectLock olock(m_Endpoint);
-//             m_Endpoint->SetSubscriptions(subscriptions);
-//     }
-//}
-
-void EndpointManager::ReconnectTimerHandler(void)
-{
-       BOOST_FOREACH(const Endpoint::Ptr& endpoint, DynamicType::GetObjects<Endpoint>()) {
-               if (endpoint->IsConnected() || endpoint == m_Endpoint)
-                       continue;
-
-               String host, port;
-               host = endpoint->GetHost();
-               port = endpoint->GetPort();
-
-               if (host.IsEmpty() || port.IsEmpty()) {
-                       Log(LogWarning, "icinga", "Can't reconnect "
-                           "to endpoint '" + endpoint->GetName() + "': No "
-                           "host/port information.");
-                       continue;
-               }
-
-               AddConnection(host, port);
-       }
-}
-
-//void EndpointManager::RequestTimerHandler(void)
-//{
-//     ObjectLock olock(this);
-//
-//     std::map<String, PendingRequest>::iterator it;
-//     for (it = m_Requests.begin(); it != m_Requests.end(); ++it) {
-//             if (it->second.HasTimedOut()) {
-//                     it->second.Callback(Endpoint::Ptr(), it->second.Request,
-//                         ResponseMessage(), true);
-//
-//                     m_Requests.erase(it);
-//
-//                     break;
-//             }
-//     }
-//}
-
-//void EndpointManager::ProcessResponseMessage(const Endpoint::Ptr& sender,
-//    const ResponseMessage& message)
-//{
-//     ObjectLock olock(this);
-//
-//     String id;
-//     if (!message.GetID(&id))
-//             BOOST_THROW_EXCEPTION(std::invalid_argument("Response message must have a message ID."));
-//
-//     std::map<String, PendingRequest>::iterator it;
-//     it = m_Requests.find(id);
-//
-//     if (it == m_Requests.end())
-//             return;
-//
-//     it->second.Callback(sender, it->second.Request, message, false);
-//
-//     m_Requests.erase(it);
-//}
-
-EndpointManager *EndpointManager::GetInstance(void)
-{
-       return Singleton<EndpointManager>::GetInstance();
-}
diff --git a/lib/remoting/i2-remoting.h b/lib/remoting/i2-remoting.h
deleted file mode 100644 (file)
index e44cafc..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/******************************************************************************
- * Icinga 2                                                                   *
- * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/)        *
- *                                                                            *
- * This program is free software; you can redistribute it and/or              *
- * modify it under the terms of the GNU General Public License                *
- * as published by the Free Software Foundation; either version 2             *
- * of the License, or (at your option) any later version.                     *
- *                                                                            *
- * This program is distributed in the hope that it will be useful,            *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
- * GNU General Public License for more details.                               *
- *                                                                            *
- * You should have received a copy of the GNU General Public License          *
- * along with this program; if not, write to the Free Software Foundation     *
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
- ******************************************************************************/
-
-#ifndef I2REMOTING_H
-#define I2REMOTING_H
-
-/**
- * @defgroup remoting Remoting library
- *
- * Implements server and client classes for the JSON-RPC protocol. Also
- * supports endpoint-based communication using messages.
- */
-
-#include "base/i2-base.h"
-
-#ifdef I2_REMOTING_BUILD
-#      define I2_REMOTING_API I2_EXPORT
-#else /* I2_REMOTING_BUILD */
-#      define I2_REMOTING_API I2_IMPORT
-#endif /* I2_REMOTING_BUILD */
-
-#endif /* I2REMOTING_H */
diff --git a/lib/remoting/remoting.vcxproj.filters b/lib/remoting/remoting.vcxproj.filters
deleted file mode 100644 (file)
index b366220..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <ItemGroup>
-    <ClCompile Include="responsemessage.cpp">
-      <Filter>Quelldateien</Filter>
-    </ClCompile>
-    <ClCompile Include="messagepart.cpp">
-      <Filter>Quelldateien</Filter>
-    </ClCompile>
-    <ClCompile Include="requestmessage.cpp">
-      <Filter>Quelldateien</Filter>
-    </ClCompile>
-    <ClCompile Include="endpoint.cpp">
-      <Filter>Quelldateien</Filter>
-    </ClCompile>
-    <ClCompile Include="endpointmanager.cpp">
-      <Filter>Quelldateien</Filter>
-    </ClCompile>
-    <ClCompile Include="remoting-type.cpp">
-      <Filter>Quelldateien</Filter>
-    </ClCompile>
-    <ClCompile Include="jsonrpc.cpp" />
-  </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="messagepart.h">
-      <Filter>Headerdateien</Filter>
-    </ClInclude>
-    <ClInclude Include="requestmessage.h">
-      <Filter>Headerdateien</Filter>
-    </ClInclude>
-    <ClInclude Include="responsemessage.h">
-      <Filter>Headerdateien</Filter>
-    </ClInclude>
-    <ClInclude Include="i2-remoting.h">
-      <Filter>Headerdateien</Filter>
-    </ClInclude>
-    <ClInclude Include="endpoint.h">
-      <Filter>Headerdateien</Filter>
-    </ClInclude>
-    <ClInclude Include="endpointmanager.h">
-      <Filter>Headerdateien</Filter>
-    </ClInclude>
-    <ClInclude Include="jsonrpc.h" />
-  </ItemGroup>
-  <ItemGroup>
-    <Filter Include="Headerdateien">
-      <UniqueIdentifier>{796f79ec-5628-4c91-9e2b-3d603ab2acfc}</UniqueIdentifier>
-    </Filter>
-    <Filter Include="Quelldateien">
-      <UniqueIdentifier>{0457f937-d12b-4328-818b-77359de2425f}</UniqueIdentifier>
-    </Filter>
-  </ItemGroup>
-  <ItemGroup>
-    <CustomBuild Include="remoting-type.conf">
-      <Filter>Quelldateien</Filter>
-    </CustomBuild>
-  </ItemGroup>
-</Project>
\ No newline at end of file