From cdcd3a6652fd00b1daa9015c23cf778aeb35031d Mon Sep 17 00:00:00 2001 From: Ara Ayvazyan Date: Sat, 1 Jul 2017 14:52:32 -0700 Subject: [PATCH] Initial commit (#1) * Initial commit * Update README.md --- .gitignore | 283 ++---------- .gitmodules | 6 + IPC | 1 + IPC.Bond.sln | 52 +++ IPC.Bond.snk | Bin 0 -> 596 bytes Inc/IPC/Bond/Accept.h | 75 ++++ Inc/IPC/Bond/Acceptor.h | 19 + Inc/IPC/Bond/BlobCast.h | 43 ++ Inc/IPC/Bond/BufferPool.h | 368 ++++++++++++++++ Inc/IPC/Bond/BufferPoolFwd.h | 57 +++ Inc/IPC/Bond/Client.h | 85 ++++ Inc/IPC/Bond/Connect.h | 88 ++++ Inc/IPC/Bond/Connector.h | 19 + Inc/IPC/Bond/DefaultTraits.h | 20 + Inc/IPC/Bond/InputBuffer.h | 263 +++++++++++ Inc/IPC/Bond/OutputBuffer.h | 228 ++++++++++ Inc/IPC/Bond/Serializer.h | 157 +++++++ Inc/IPC/Bond/Server.h | 58 +++ Inc/IPC/Bond/Transport.h | 200 +++++++++ Inc/IPC/Bond/detail/BlobHolder.h | 57 +++ Inc/IPC/Bond/detail/BufferPoolHolder.h | 55 +++ Inc/IPC/Bond/detail/ComponentBase.h | 61 +++ Interop/Build/Interop.vcxproj | 73 ++++ Interop/Build/Interop.vcxproj.filters | 45 ++ Interop/Build/packages.config | 4 + Interop/Inc/detail/Interop/BufferPool.h | 48 ++ Interop/Inc/detail/Interop/InputBuffer.h | 66 +++ Interop/Inc/detail/Interop/OutputBuffer.h | 62 +++ Interop/Inc/stdafx.h | 3 + Interop/Src/detail/Interop/BufferPool.cpp | 72 +++ Interop/Src/detail/Interop/InputBuffer.cpp | 122 ++++++ Interop/Src/detail/Interop/OutputBuffer.cpp | 96 ++++ Interop/Src/detail/Interop/Transport.cpp | 20 + Interop/Src/stdafx.cpp | 1 + LICENSE | 10 +- Managed/Build/Managed.vcxproj | 102 +++++ Managed/Build/Managed.vcxproj.filters | 18 + Managed/Build/packages.config | 5 + Managed/Inc/BufferPool.h | 60 +++ Managed/Inc/InputStream.h | 65 +++ Managed/Inc/OutputStream.h | 56 +++ Managed/Src/AssemblyInfo.cpp | 18 + Managed/Src/BufferPool.cpp | 69 +++ Managed/Src/InputStream.cpp | 132 ++++++ Managed/Src/OutputStream.cpp | 120 +++++ Managed/Src/Transport.cpp | 38 ++ Native/Build/Native.vcxproj | 81 ++++ Native/Build/Native.vcxproj.filters | 44 ++ Native/Build/packages.config | 4 + Native/Inc/stdafx.h | 3 + Native/Src/stdafx.cpp | 1 + README.md | 25 ++ Transport/AccessorBase.cs | 73 ++++ Transport/AssemblyInfo.cs | 18 + Transport/Client.cs | 48 ++ Transport/ClientAccessor.cs | 57 +++ Transport/ClientConnector.cs | 36 ++ Transport/Component.cs | 46 ++ Transport/Config.cs | 11 + Transport/Disposable.cs | 38 ++ Transport/Serializer.cs | 51 +++ Transport/SerializerFactory.cs | 188 ++++++++ Transport/Server.cs | 26 ++ Transport/ServerAcceptor.cs | 49 +++ Transport/ServersAccessor.cs | 47 ++ Transport/Transport.cs | 105 +++++ Transport/Transport.csproj | 76 ++++ Transport/packages.config | 4 + UnitTests/BlobCastTests.cpp | 128 ++++++ UnitTests/BufferPoolTests.cpp | 214 +++++++++ UnitTests/Build/UnitTests.vcxproj | 93 ++++ UnitTests/Build/UnitTests.vcxproj.filters | 21 + UnitTests/Build/packages.config | 9 + UnitTests/ClientServerTests.cpp | 204 +++++++++ UnitTests/ConnectAcceptTests.cpp | 183 ++++++++ UnitTests/InputBufferTests.cpp | 460 ++++++++++++++++++++ UnitTests/OutputBufferTests.cpp | 460 ++++++++++++++++++++ UnitTests/SerializerTests.cpp | 342 +++++++++++++++ UnitTests/TransportTests.cpp | 397 +++++++++++++++++ UnitTests/UsageTests.cpp | 403 +++++++++++++++++ UnitTests/stdafx.cpp | 1 + UnitTests/stdafx.h | 6 + UnitTestsManaged/SerializationTests.cs | 111 +++++ UnitTestsManaged/Test.bond | 37 ++ UnitTestsManaged/TransportTests.cs | 87 ++++ UnitTestsManaged/UnitTestsManaged.csproj | 77 ++++ UnitTestsManaged/packages.config | 6 + bond | 1 + bond.cmd | 18 + nuget.config | 6 + 90 files changed, 7547 insertions(+), 248 deletions(-) create mode 100644 .gitmodules create mode 160000 IPC create mode 100644 IPC.Bond.sln create mode 100644 IPC.Bond.snk create mode 100644 Inc/IPC/Bond/Accept.h create mode 100644 Inc/IPC/Bond/Acceptor.h create mode 100644 Inc/IPC/Bond/BlobCast.h create mode 100644 Inc/IPC/Bond/BufferPool.h create mode 100644 Inc/IPC/Bond/BufferPoolFwd.h create mode 100644 Inc/IPC/Bond/Client.h create mode 100644 Inc/IPC/Bond/Connect.h create mode 100644 Inc/IPC/Bond/Connector.h create mode 100644 Inc/IPC/Bond/DefaultTraits.h create mode 100644 Inc/IPC/Bond/InputBuffer.h create mode 100644 Inc/IPC/Bond/OutputBuffer.h create mode 100644 Inc/IPC/Bond/Serializer.h create mode 100644 Inc/IPC/Bond/Server.h create mode 100644 Inc/IPC/Bond/Transport.h create mode 100644 Inc/IPC/Bond/detail/BlobHolder.h create mode 100644 Inc/IPC/Bond/detail/BufferPoolHolder.h create mode 100644 Inc/IPC/Bond/detail/ComponentBase.h create mode 100644 Interop/Build/Interop.vcxproj create mode 100644 Interop/Build/Interop.vcxproj.filters create mode 100644 Interop/Build/packages.config create mode 100644 Interop/Inc/detail/Interop/BufferPool.h create mode 100644 Interop/Inc/detail/Interop/InputBuffer.h create mode 100644 Interop/Inc/detail/Interop/OutputBuffer.h create mode 100644 Interop/Inc/stdafx.h create mode 100644 Interop/Src/detail/Interop/BufferPool.cpp create mode 100644 Interop/Src/detail/Interop/InputBuffer.cpp create mode 100644 Interop/Src/detail/Interop/OutputBuffer.cpp create mode 100644 Interop/Src/detail/Interop/Transport.cpp create mode 100644 Interop/Src/stdafx.cpp create mode 100644 Managed/Build/Managed.vcxproj create mode 100644 Managed/Build/Managed.vcxproj.filters create mode 100644 Managed/Build/packages.config create mode 100644 Managed/Inc/BufferPool.h create mode 100644 Managed/Inc/InputStream.h create mode 100644 Managed/Inc/OutputStream.h create mode 100644 Managed/Src/AssemblyInfo.cpp create mode 100644 Managed/Src/BufferPool.cpp create mode 100644 Managed/Src/InputStream.cpp create mode 100644 Managed/Src/OutputStream.cpp create mode 100644 Managed/Src/Transport.cpp create mode 100644 Native/Build/Native.vcxproj create mode 100644 Native/Build/Native.vcxproj.filters create mode 100644 Native/Build/packages.config create mode 100644 Native/Inc/stdafx.h create mode 100644 Native/Src/stdafx.cpp create mode 100644 Transport/AccessorBase.cs create mode 100644 Transport/AssemblyInfo.cs create mode 100644 Transport/Client.cs create mode 100644 Transport/ClientAccessor.cs create mode 100644 Transport/ClientConnector.cs create mode 100644 Transport/Component.cs create mode 100644 Transport/Config.cs create mode 100644 Transport/Disposable.cs create mode 100644 Transport/Serializer.cs create mode 100644 Transport/SerializerFactory.cs create mode 100644 Transport/Server.cs create mode 100644 Transport/ServerAcceptor.cs create mode 100644 Transport/ServersAccessor.cs create mode 100644 Transport/Transport.cs create mode 100644 Transport/Transport.csproj create mode 100644 Transport/packages.config create mode 100644 UnitTests/BlobCastTests.cpp create mode 100644 UnitTests/BufferPoolTests.cpp create mode 100644 UnitTests/Build/UnitTests.vcxproj create mode 100644 UnitTests/Build/UnitTests.vcxproj.filters create mode 100644 UnitTests/Build/packages.config create mode 100644 UnitTests/ClientServerTests.cpp create mode 100644 UnitTests/ConnectAcceptTests.cpp create mode 100644 UnitTests/InputBufferTests.cpp create mode 100644 UnitTests/OutputBufferTests.cpp create mode 100644 UnitTests/SerializerTests.cpp create mode 100644 UnitTests/TransportTests.cpp create mode 100644 UnitTests/UsageTests.cpp create mode 100644 UnitTests/stdafx.cpp create mode 100644 UnitTests/stdafx.h create mode 100644 UnitTestsManaged/SerializationTests.cs create mode 100644 UnitTestsManaged/Test.bond create mode 100644 UnitTestsManaged/TransportTests.cs create mode 100644 UnitTestsManaged/UnitTestsManaged.csproj create mode 100644 UnitTestsManaged/packages.config create mode 160000 bond create mode 100644 bond.cmd create mode 100644 nuget.config diff --git a/.gitignore b/.gitignore index f1e3d20..7791dd4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,252 +1,45 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# DNX -project.lock.json -artifacts/ - -*_i.c -*_p.c -*_i.h -*.ilk -*.meta +# Compiled Object files +*.slo +*.lo +*.o *.obj + +# Precompiled Headers +/ipch +*.gch *.pch -*.pdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc -# Chutzpah Test files -_Chutzpah* +# Compiled Dynamic libraries +*.so +*.dylib +*.dll -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# Nuget packages +/packages + +# Visual Studio files +/.vs +*.VC.opendb *.VC.db -*.VC.VC.opendb +*.vcxproj.user -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap +# Build folders +**/x64 -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# TODO: Comment the next line if you want to checkin your web deploy settings -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/packages/* -# except build/, which is used as an MSBuild target. -!**/packages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/packages/repositories.config -# NuGet v3's project.json files produces more ignoreable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.pfx -*.publishsettings -node_modules/ -orleans.codegen.cs - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm - -# SQL Server files -*.mdf -*.ldf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml +# Generated files +UnitTestsManaged/generated diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..855ad06 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "IPC"] + path = IPC + url = https://github.com/Microsoft/IPC +[submodule "bond"] + path = bond + url = https://github.com/Microsoft/bond.git diff --git a/IPC b/IPC new file mode 160000 index 0000000..1f34d78 --- /dev/null +++ b/IPC @@ -0,0 +1 @@ +Subproject commit 1f34d78408cd68e234305682a96f60ec5dd535af diff --git a/IPC.Bond.sln b/IPC.Bond.sln new file mode 100644 index 0000000..88a50a8 --- /dev/null +++ b/IPC.Bond.sln @@ -0,0 +1,52 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests", "UnitTests\Build\UnitTests.vcxproj", "{2A3B9657-1D10-4A71-AA21-62AD4106CED4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Native", "Native\Build\Native.vcxproj", "{2030ED0D-4667-4299-87CD-ACE298BDF56D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Interop", "Interop\Build\Interop.vcxproj", "{A13012C1-76DE-4D1D-A58B-2361D2BE8F65}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Managed", "Managed\Build\Managed.vcxproj", "{705098F7-93DC-4954-8165-FDDCD66231F0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Transport", "Transport\Transport.csproj", "{BDAAAAAD-21A8-446E-840B-68718C49E7D4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestsManaged", "UnitTestsManaged\UnitTestsManaged.csproj", "{BDFCB3AD-21A8-446E-840B-68718C49E7D4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2A3B9657-1D10-4A71-AA21-62AD4106CED4}.Debug|x64.ActiveCfg = Debug|x64 + {2A3B9657-1D10-4A71-AA21-62AD4106CED4}.Debug|x64.Build.0 = Debug|x64 + {2A3B9657-1D10-4A71-AA21-62AD4106CED4}.Release|x64.ActiveCfg = Release|x64 + {2A3B9657-1D10-4A71-AA21-62AD4106CED4}.Release|x64.Build.0 = Release|x64 + {2030ED0D-4667-4299-87CD-ACE298BDF56D}.Debug|x64.ActiveCfg = Debug|x64 + {2030ED0D-4667-4299-87CD-ACE298BDF56D}.Debug|x64.Build.0 = Debug|x64 + {2030ED0D-4667-4299-87CD-ACE298BDF56D}.Release|x64.ActiveCfg = Release|x64 + {2030ED0D-4667-4299-87CD-ACE298BDF56D}.Release|x64.Build.0 = Release|x64 + {A13012C1-76DE-4D1D-A58B-2361D2BE8F65}.Debug|x64.ActiveCfg = Debug|x64 + {A13012C1-76DE-4D1D-A58B-2361D2BE8F65}.Debug|x64.Build.0 = Debug|x64 + {A13012C1-76DE-4D1D-A58B-2361D2BE8F65}.Release|x64.ActiveCfg = Release|x64 + {A13012C1-76DE-4D1D-A58B-2361D2BE8F65}.Release|x64.Build.0 = Release|x64 + {705098F7-93DC-4954-8165-FDDCD66231F0}.Debug|x64.ActiveCfg = Debug|x64 + {705098F7-93DC-4954-8165-FDDCD66231F0}.Debug|x64.Build.0 = Debug|x64 + {705098F7-93DC-4954-8165-FDDCD66231F0}.Release|x64.ActiveCfg = Release|x64 + {705098F7-93DC-4954-8165-FDDCD66231F0}.Release|x64.Build.0 = Release|x64 + {BDAAAAAD-21A8-446E-840B-68718C49E7D4}.Debug|x64.ActiveCfg = Debug|x64 + {BDAAAAAD-21A8-446E-840B-68718C49E7D4}.Debug|x64.Build.0 = Debug|x64 + {BDAAAAAD-21A8-446E-840B-68718C49E7D4}.Release|x64.ActiveCfg = Release|x64 + {BDAAAAAD-21A8-446E-840B-68718C49E7D4}.Release|x64.Build.0 = Release|x64 + {BDFCB3AD-21A8-446E-840B-68718C49E7D4}.Debug|x64.ActiveCfg = Debug|x64 + {BDFCB3AD-21A8-446E-840B-68718C49E7D4}.Debug|x64.Build.0 = Debug|x64 + {BDFCB3AD-21A8-446E-840B-68718C49E7D4}.Release|x64.ActiveCfg = Release|x64 + {BDFCB3AD-21A8-446E-840B-68718C49E7D4}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/IPC.Bond.snk b/IPC.Bond.snk new file mode 100644 index 0000000000000000000000000000000000000000..aa2c75c232bc7dcead084378d44e4bbfe52c90eb GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50096oQ;lb+ANaH}cq408(NYgMM5ZB6hynWF z!Zj1DznPO?Ci}7>$#(WO7b|Jo#9hpjrS$;#;1s|_dCt3F^6X;a;WjTkd63@Fs=)3z9*DhSUVX0%RJM7+9)_1s4||Y~mF(p$ z$^C8#ektMyo)n(AkT$l;aFh&rs?N5N39dMJg48$Rz_7ROqta`L6;t>GkqFSpDorJ) ze)WqkCMVyreF@_}4PM)hiJ` z8|ZMXY<6Y?9l|($<>%b`U4F4Gb>Lf)Elblx5+FbkR+O4npAnyOVQETBa{i>>M#3VD iAY~u8cpbIlR0Q`Tb^w2a6c}lbr&x%r#0x +#include +#include +#include "Acceptor.h" +#include "Client.h" +#include "Server.h" +#include "DefaultTraits.h" +#include +#include + + +namespace IPC +{ +namespace Bond +{ + template + auto AcceptServers( + const char* name, + HandlerFactory&& handlerFactory, + bond::ProtocolType protocol = bond::ProtocolType::COMPACT_PROTOCOL, + bool marshal = true, + ChannelSettings channelSettings = {}, + std::size_t minBlobSize = 0, + std::size_t hostInfoMemorySize = 0, + ErrorHandler&& errorHandler = {}) + { + return IPC::detail::Accept>( + name, + std::make_shared>>(), + [protocol, marshal, minBlobSize, handlerFactory = std::forward(handlerFactory)](auto&& connection, auto&& closeHandler) mutable + { + return MakeServer( + std::move(connection), handlerFactory, std::forward(closeHandler), protocol, marshal, minBlobSize); + }, + std::forward(errorHandler), + std::move(channelSettings), + hostInfoMemorySize); + } + + + template + auto AcceptClients( + const char* name, + bond::ProtocolType protocol = bond::ProtocolType::COMPACT_PROTOCOL, + bool marshal = true, + ChannelSettings channelSettings = {}, + std::size_t minBlobSize = 0, + std::size_t hostInfoMemorySize = 0, + ErrorHandler&& errorHandler = {}, + typename Traits::TransactionManagerFactory transactionManagerFactory = {}) + { + using Client = Client; + + return IPC::detail::Accept>( + name, + std::make_shared>(), + [protocol, marshal, minBlobSize, transactionManagerFactory = std::move(transactionManagerFactory)](auto&& connection, auto&& closeHandler) + { + return MakeClient( + std::move(connection), + std::forward(closeHandler), + protocol, + marshal, + minBlobSize, + transactionManagerFactory(IPC::detail::Identity{})); + }, + std::forward(errorHandler), + std::move(channelSettings), + hostInfoMemorySize); + } + +} // Bond +} // IPC diff --git a/Inc/IPC/Bond/Acceptor.h b/Inc/IPC/Bond/Acceptor.h new file mode 100644 index 0000000..a484135 --- /dev/null +++ b/Inc/IPC/Bond/Acceptor.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include "detail/ComponentBase.h" +#include "DefaultTraits.h" + + +namespace IPC +{ +namespace Bond +{ + template + using ClientAcceptor = detail::BufferComponent; + + template + using ServerAcceptor = detail::BufferComponent; + +} // Bond +} // IPC diff --git a/Inc/IPC/Bond/BlobCast.h b/Inc/IPC/Bond/BlobCast.h new file mode 100644 index 0000000..cae90ce --- /dev/null +++ b/Inc/IPC/Bond/BlobCast.h @@ -0,0 +1,43 @@ +#pragma once + +#include "detail/BlobHolder.h" +#include + +#ifndef NDEBUG +#include +#endif + + +namespace IPC +{ +namespace Bond +{ + template + bond::blob BlobCast(Blob&& from, std::shared_ptr memory) + { + auto data = from.data(); + auto size = from.size(); + + assert(memory && memory->Contains(data) && memory->Contains(data + size - 1)); + + return{ + boost::shared_ptr{ data, detail::BlobHolder>{ std::forward(from), std::move(memory) } }, + static_cast(size) }; + } + + template + Blob BlobCast(const bond::blob& from) + { + if (auto deleter = boost::get_deleter>(bond::blob_cast(from))) + { + const auto& blob = deleter->m_blob; + assert(blob); + + return blob.GetRange(std::distance(blob.data(), from.content()), from.size()); + } + + return{}; + } + +} // Bond +} // IPC diff --git a/Inc/IPC/Bond/BufferPool.h b/Inc/IPC/Bond/BufferPool.h new file mode 100644 index 0000000..12f138e --- /dev/null +++ b/Inc/IPC/Bond/BufferPool.h @@ -0,0 +1,368 @@ +#pragma once + +#include "BufferPoolFwd.h" +#include "IPC/SharedMemory.h" +#include "IPC/detail/LockFree/Queue.h" +#include + + +namespace IPC +{ +namespace Bond +{ + template