aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/echo.cpp
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2020-11-24 13:59:33 -0500
committerRussell Yanofsky <russ@yanofsky.org>2021-04-23 03:02:50 -0500
commit84934bf70e11fe4cda1cfda60113a54895d4fdd5 (patch)
treea76e8bd27d3e32a9f433d6f24857d6b96e499efc /src/interfaces/echo.cpp
parent7d76cf667eff512043a28d4407cc89f58796c42b (diff)
multiprocess: Add echoipc RPC method and test
Add simple interfaces::Echo IPC interface with one method that just takes and returns a string, to test multiprocess framework and provide an example of how it can be used to spawn and call between processes.
Diffstat (limited to 'src/interfaces/echo.cpp')
-rw-r--r--src/interfaces/echo.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/interfaces/echo.cpp b/src/interfaces/echo.cpp
new file mode 100644
index 0000000000..9bbb42217b
--- /dev/null
+++ b/src/interfaces/echo.cpp
@@ -0,0 +1,18 @@
+// Copyright (c) 2021 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#include <interfaces/echo.h>
+
+#include <memory>
+
+namespace interfaces {
+namespace {
+class EchoImpl : public Echo
+{
+public:
+ std::string echo(const std::string& echo) override { return echo; }
+};
+} // namespace
+std::unique_ptr<Echo> MakeEcho() { return std::make_unique<EchoImpl>(); }
+} // namespace interfaces