From a6523aa85d015b7495c0d994c6f0190cb76b15b7 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Mon, 24 Nov 2025 11:57:38 -0500 Subject: [PATCH 1/3] Move rpc directory from messages to top level. --- Makefile.am | 68 ++++---- builds/cmake/CMakeLists.txt | 10 +- .../libbitcoin-network-test.vcxproj | 12 +- .../libbitcoin-network-test.vcxproj.filters | 40 ++--- .../libbitcoin-network.vcxproj | 38 ++-- .../libbitcoin-network.vcxproj.filters | 163 +++++++++--------- include/bitcoin/network.hpp | 34 ++-- .../bitcoin/network/channels/channel_http.hpp | 2 +- .../bitcoin/network/channels/channel_peer.hpp | 2 +- .../impl/{messages => }/rpc/dispatcher.ipp | 10 +- .../network/{messages => }/rpc/any.hpp | 4 +- .../network/{messages => }/rpc/dispatcher.hpp | 10 +- .../{messages => }/rpc/enums/grouping.hpp | 4 +- .../{messages => }/rpc/enums/version.hpp | 4 +- .../rpc/interfaces/bitcoind.hpp | 6 +- .../rpc/interfaces/electrum.hpp | 6 +- .../{messages => }/rpc/interfaces/explore.hpp | 6 +- .../{messages => }/rpc/interfaces/http.hpp | 6 +- .../rpc/interfaces/interfaces.hpp | 18 +- .../{messages => }/rpc/interfaces/peer.hpp | 6 +- .../rpc/interfaces/stratum_v1.hpp | 6 +- .../rpc/interfaces/stratum_v2.hpp | 6 +- .../network/{messages => }/rpc/method.hpp | 6 +- .../network/{messages => }/rpc/model.hpp | 8 +- .../network/{messages => }/rpc/publish.hpp | 8 +- .../network/{messages => }/rpc/rpc.hpp | 22 +-- .../network/{messages => }/rpc/types.hpp | 6 +- src/channels/channel_http.cpp | 2 +- src/{messages => }/rpc/model.cpp | 4 +- test/messages/http/method.cpp | 2 +- test/{messages => }/rpc/any.cpp | 4 +- test/{messages => }/rpc/dispatcher.cpp | 2 +- test/{messages => }/rpc/method.cpp | 6 +- test/{messages => }/rpc/types.cpp | 6 +- 34 files changed, 263 insertions(+), 274 deletions(-) rename include/bitcoin/network/impl/{messages => }/rpc/dispatcher.ipp (97%) rename include/bitcoin/network/{messages => }/rpc/any.hpp (97%) rename include/bitcoin/network/{messages => }/rpc/dispatcher.hpp (95%) rename include/bitcoin/network/{messages => }/rpc/enums/grouping.hpp (91%) rename include/bitcoin/network/{messages => }/rpc/enums/version.hpp (91%) rename include/bitcoin/network/{messages => }/rpc/interfaces/bitcoind.hpp (98%) rename include/bitcoin/network/{messages => }/rpc/interfaces/electrum.hpp (95%) rename include/bitcoin/network/{messages => }/rpc/interfaces/explore.hpp (96%) rename include/bitcoin/network/{messages => }/rpc/interfaces/http.hpp (91%) rename include/bitcoin/network/{messages => }/rpc/interfaces/interfaces.hpp (70%) rename include/bitcoin/network/{messages => }/rpc/interfaces/peer.hpp (97%) rename include/bitcoin/network/{messages => }/rpc/interfaces/stratum_v1.hpp (93%) rename include/bitcoin/network/{messages => }/rpc/interfaces/stratum_v2.hpp (96%) rename include/bitcoin/network/{messages => }/rpc/method.hpp (95%) rename include/bitcoin/network/{messages => }/rpc/model.hpp (96%) rename include/bitcoin/network/{messages => }/rpc/publish.hpp (86%) rename include/bitcoin/network/{messages => }/rpc/rpc.hpp (57%) rename include/bitcoin/network/{messages => }/rpc/types.hpp (98%) rename src/{messages => }/rpc/model.cpp (98%) rename test/{messages => }/rpc/any.cpp (98%) rename test/{messages => }/rpc/dispatcher.cpp (99%) rename test/{messages => }/rpc/method.cpp (97%) rename test/{messages => }/rpc/types.cpp (99%) diff --git a/Makefile.am b/Makefile.am index df5125e92..0dc4ee474 100644 --- a/Makefile.am +++ b/Makefile.am @@ -100,7 +100,6 @@ src_libbitcoin_network_la_SOURCES = \ src/messages/peer/version.cpp \ src/messages/peer/version_acknowledge.cpp \ src/messages/peer/witness_tx_id_relay.cpp \ - src/messages/rpc/model.cpp \ src/net/acceptor.cpp \ src/net/broadcaster.cpp \ src/net/connector.cpp \ @@ -122,6 +121,7 @@ src_libbitcoin_network_la_SOURCES = \ src/protocols/protocol_version_70001.cpp \ src/protocols/protocol_version_70002.cpp \ src/protocols/protocol_version_70016.cpp \ + src/rpc/model.cpp \ src/sessions/session.cpp \ src/sessions/session_inbound.cpp \ src/sessions/session_manual.cpp \ @@ -224,10 +224,6 @@ test_libbitcoin_network_test_SOURCES = \ test/messages/peer/enums/level.cpp \ test/messages/peer/enums/magic_numbers.cpp \ test/messages/peer/enums/service.cpp \ - test/messages/rpc/any.cpp \ - test/messages/rpc/dispatcher.cpp \ - test/messages/rpc/method.cpp \ - test/messages/rpc/types.cpp \ test/net/acceptor.cpp \ test/net/broadcaster.cpp \ test/net/connector.cpp \ @@ -250,6 +246,10 @@ test_libbitcoin_network_test_SOURCES = \ test/protocols/protocol_version_70001.cpp \ test/protocols/protocol_version_70002.cpp \ test/protocols/protocol_version_70016.cpp \ + test/rpc/any.cpp \ + test/rpc/dispatcher.cpp \ + test/rpc/method.cpp \ + test/rpc/types.cpp \ test/sessions/session.cpp \ test/sessions/session_html.cpp \ test/sessions/session_inbound.cpp \ @@ -331,9 +331,9 @@ include_bitcoin_network_impl_async_races_HEADERS = \ include/bitcoin/network/impl/async/races/race_unity.ipp \ include/bitcoin/network/impl/async/races/race_volume.ipp -include_bitcoin_network_impl_messages_rpcdir = ${includedir}/bitcoin/network/impl/messages/rpc -include_bitcoin_network_impl_messages_rpc_HEADERS = \ - include/bitcoin/network/impl/messages/rpc/dispatcher.ipp +include_bitcoin_network_impl_rpcdir = ${includedir}/bitcoin/network/impl/rpc +include_bitcoin_network_impl_rpc_HEADERS = \ + include/bitcoin/network/impl/rpc/dispatcher.ipp include_bitcoin_network_logdir = ${includedir}/bitcoin/network/log include_bitcoin_network_log_HEADERS = \ @@ -418,32 +418,6 @@ include_bitcoin_network_messages_peer_enums_HEADERS = \ include/bitcoin/network/messages/peer/enums/magic_numbers.hpp \ include/bitcoin/network/messages/peer/enums/service.hpp -include_bitcoin_network_messages_rpcdir = ${includedir}/bitcoin/network/messages/rpc -include_bitcoin_network_messages_rpc_HEADERS = \ - include/bitcoin/network/messages/rpc/any.hpp \ - include/bitcoin/network/messages/rpc/dispatcher.hpp \ - include/bitcoin/network/messages/rpc/method.hpp \ - include/bitcoin/network/messages/rpc/model.hpp \ - include/bitcoin/network/messages/rpc/publish.hpp \ - include/bitcoin/network/messages/rpc/rpc.hpp \ - include/bitcoin/network/messages/rpc/types.hpp - -include_bitcoin_network_messages_rpc_enumsdir = ${includedir}/bitcoin/network/messages/rpc/enums -include_bitcoin_network_messages_rpc_enums_HEADERS = \ - include/bitcoin/network/messages/rpc/enums/grouping.hpp \ - include/bitcoin/network/messages/rpc/enums/version.hpp - -include_bitcoin_network_messages_rpc_interfacesdir = ${includedir}/bitcoin/network/messages/rpc/interfaces -include_bitcoin_network_messages_rpc_interfaces_HEADERS = \ - include/bitcoin/network/messages/rpc/interfaces/bitcoind.hpp \ - include/bitcoin/network/messages/rpc/interfaces/electrum.hpp \ - include/bitcoin/network/messages/rpc/interfaces/explore.hpp \ - include/bitcoin/network/messages/rpc/interfaces/http.hpp \ - include/bitcoin/network/messages/rpc/interfaces/interfaces.hpp \ - include/bitcoin/network/messages/rpc/interfaces/peer.hpp \ - include/bitcoin/network/messages/rpc/interfaces/stratum_v1.hpp \ - include/bitcoin/network/messages/rpc/interfaces/stratum_v2.hpp - include_bitcoin_network_netdir = ${includedir}/bitcoin/network/net include_bitcoin_network_net_HEADERS = \ include/bitcoin/network/net/acceptor.hpp \ @@ -475,6 +449,32 @@ include_bitcoin_network_protocols_HEADERS = \ include/bitcoin/network/protocols/protocol_ws.hpp \ include/bitcoin/network/protocols/protocols.hpp +include_bitcoin_network_rpcdir = ${includedir}/bitcoin/network/rpc +include_bitcoin_network_rpc_HEADERS = \ + include/bitcoin/network/rpc/any.hpp \ + include/bitcoin/network/rpc/dispatcher.hpp \ + include/bitcoin/network/rpc/method.hpp \ + include/bitcoin/network/rpc/model.hpp \ + include/bitcoin/network/rpc/publish.hpp \ + include/bitcoin/network/rpc/rpc.hpp \ + include/bitcoin/network/rpc/types.hpp + +include_bitcoin_network_rpc_enumsdir = ${includedir}/bitcoin/network/rpc/enums +include_bitcoin_network_rpc_enums_HEADERS = \ + include/bitcoin/network/rpc/enums/grouping.hpp \ + include/bitcoin/network/rpc/enums/version.hpp + +include_bitcoin_network_rpc_interfacesdir = ${includedir}/bitcoin/network/rpc/interfaces +include_bitcoin_network_rpc_interfaces_HEADERS = \ + include/bitcoin/network/rpc/interfaces/bitcoind.hpp \ + include/bitcoin/network/rpc/interfaces/electrum.hpp \ + include/bitcoin/network/rpc/interfaces/explore.hpp \ + include/bitcoin/network/rpc/interfaces/http.hpp \ + include/bitcoin/network/rpc/interfaces/interfaces.hpp \ + include/bitcoin/network/rpc/interfaces/peer.hpp \ + include/bitcoin/network/rpc/interfaces/stratum_v1.hpp \ + include/bitcoin/network/rpc/interfaces/stratum_v2.hpp + include_bitcoin_network_sessionsdir = ${includedir}/bitcoin/network/sessions include_bitcoin_network_sessions_HEADERS = \ include/bitcoin/network/sessions/session.hpp \ diff --git a/builds/cmake/CMakeLists.txt b/builds/cmake/CMakeLists.txt index 383088ba9..2e3164fb3 100644 --- a/builds/cmake/CMakeLists.txt +++ b/builds/cmake/CMakeLists.txt @@ -282,7 +282,6 @@ add_library( ${CANONICAL_LIB_NAME} "../../src/messages/peer/version.cpp" "../../src/messages/peer/version_acknowledge.cpp" "../../src/messages/peer/witness_tx_id_relay.cpp" - "../../src/messages/rpc/model.cpp" "../../src/net/acceptor.cpp" "../../src/net/broadcaster.cpp" "../../src/net/connector.cpp" @@ -304,6 +303,7 @@ add_library( ${CANONICAL_LIB_NAME} "../../src/protocols/protocol_version_70001.cpp" "../../src/protocols/protocol_version_70002.cpp" "../../src/protocols/protocol_version_70016.cpp" + "../../src/rpc/model.cpp" "../../src/sessions/session.cpp" "../../src/sessions/session_inbound.cpp" "../../src/sessions/session_manual.cpp" @@ -430,10 +430,6 @@ if (with-tests) "../../test/messages/peer/enums/level.cpp" "../../test/messages/peer/enums/magic_numbers.cpp" "../../test/messages/peer/enums/service.cpp" - "../../test/messages/rpc/any.cpp" - "../../test/messages/rpc/dispatcher.cpp" - "../../test/messages/rpc/method.cpp" - "../../test/messages/rpc/types.cpp" "../../test/net/acceptor.cpp" "../../test/net/broadcaster.cpp" "../../test/net/connector.cpp" @@ -456,6 +452,10 @@ if (with-tests) "../../test/protocols/protocol_version_70001.cpp" "../../test/protocols/protocol_version_70002.cpp" "../../test/protocols/protocol_version_70016.cpp" + "../../test/rpc/any.cpp" + "../../test/rpc/dispatcher.cpp" + "../../test/rpc/method.cpp" + "../../test/rpc/types.cpp" "../../test/sessions/session.cpp" "../../test/sessions/session_html.cpp" "../../test/sessions/session_inbound.cpp" diff --git a/builds/msvc/vs2022/libbitcoin-network-test/libbitcoin-network-test.vcxproj b/builds/msvc/vs2022/libbitcoin-network-test/libbitcoin-network-test.vcxproj index db3c344eb..fc969320d 100644 --- a/builds/msvc/vs2022/libbitcoin-network-test/libbitcoin-network-test.vcxproj +++ b/builds/msvc/vs2022/libbitcoin-network-test/libbitcoin-network-test.vcxproj @@ -216,12 +216,6 @@ - - - - $(IntDir)test_messages_rpc_method.obj - - @@ -245,6 +239,12 @@ + + + + $(IntDir)test_rpc_method.obj + + diff --git a/builds/msvc/vs2022/libbitcoin-network-test/libbitcoin-network-test.vcxproj.filters b/builds/msvc/vs2022/libbitcoin-network-test/libbitcoin-network-test.vcxproj.filters index fe613bbac..1eff17b42 100644 --- a/builds/msvc/vs2022/libbitcoin-network-test/libbitcoin-network-test.vcxproj.filters +++ b/builds/msvc/vs2022/libbitcoin-network-test/libbitcoin-network-test.vcxproj.filters @@ -14,7 +14,7 @@ {D28FC18A-8B81-4247-0000-000000000001} - {D28FC18A-8B81-4247-0000-000000000009} + {D28FC18A-8B81-4247-0000-00000000000A} {D28FC18A-8B81-4247-0000-000000000002} @@ -29,32 +29,32 @@ {D28FC18A-8B81-4247-0000-000000000005} - {D28FC18A-8B81-4247-0000-00000000000A} + {D28FC18A-8B81-4247-0000-00000000000B} {D28FC18A-8B81-4247-0000-00000000000E} - {D28FC18A-8B81-4247-0000-00000000000B} + {D28FC18A-8B81-4247-0000-00000000000C} - {D28FC18A-8B81-4247-0000-00000000000C} + {D28FC18A-8B81-4247-0000-00000000000D} {D28FC18A-8B81-4247-0000-00000000000F} - - {D28FC18A-8B81-4247-0000-00000000000D} - {D28FC18A-8B81-4247-0000-000000000006} {D28FC18A-8B81-4247-0000-000000000007} - + {D28FC18A-8B81-4247-0000-000000000008} + + {D28FC18A-8B81-4247-0000-000000000009} + @@ -297,18 +297,6 @@ src\messages\peer - - src\messages\rpc - - - src\messages\rpc - - - src\messages\rpc - - - src\messages\rpc - src @@ -378,6 +366,18 @@ src\protocols + + src\rpc + + + src\rpc + + + src\rpc + + + src\rpc + src\sessions diff --git a/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj b/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj index 586c33065..5db77f53a 100644 --- a/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj +++ b/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj @@ -192,7 +192,6 @@ - @@ -215,6 +214,7 @@ + @@ -323,23 +323,6 @@ - - - - - - - - - - - - - - - - - @@ -366,6 +349,23 @@ + + + + + + + + + + + + + + + + + @@ -387,7 +387,7 @@ - + diff --git a/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj.filters b/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj.filters index 7b7972de6..53dd738a3 100644 --- a/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj.filters +++ b/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj.filters @@ -20,7 +20,7 @@ {564EB540-D6B6-425C-0000-000000000002} - {564EB540-D6B6-425C-0000-0000000000A1} + {564EB540-D6B6-425C-0000-0000000000B1} {564EB540-D6B6-425C-0000-000000000003} @@ -32,17 +32,14 @@ {564EB540-D6B6-425C-0000-000000000005} - {564EB540-D6B6-425C-0000-0000000000B1} - - - {564EB540-D6B6-425C-0000-0000000000D1} - - {564EB540-D6B6-425C-0000-0000000000C1} - + {564EB540-D6B6-425C-0000-0000000000E1} + + {564EB540-D6B6-425C-0000-0000000000D1} + {564EB540-D6B6-425C-0000-000000000006} @@ -53,7 +50,7 @@ {564EB540-D6B6-425C-0000-0000000000F1} - {564EB540-D6B6-425C-0000-000000000005} + {564EB540-D6B6-425C-0000-000000000004} {564EB540-D6B6-425C-0000-000000000002} @@ -62,16 +59,7 @@ {564EB540-D6B6-425C-0000-000000000003} - {564EB540-D6B6-425C-0000-000000000006} - - - {564EB540-D6B6-425C-0000-000000000004} - - - {564EB540-D6B6-425C-0000-000000000007} - - - {564EB540-D6B6-425C-0000-000000000008} + {564EB540-D6B6-425C-0000-000000000005} {564EB540-D6B6-425C-0000-000000000008} @@ -79,11 +67,20 @@ {564EB540-D6B6-425C-0000-000000000009} - + {564EB540-D6B6-425C-0000-000000000010} + + {564EB540-D6B6-425C-0000-000000000006} + + + {564EB540-D6B6-425C-0000-000000000007} + + + {564EB540-D6B6-425C-0000-0000000000A1} + - {564EB540-D6B6-425C-0000-000000000009} + {564EB540-D6B6-425C-0000-000000000008} {564EB540-D6B6-425C-0000-000000000000} @@ -104,18 +101,15 @@ {564EB540-D6B6-425C-0000-000000000005} - {564EB540-D6B6-425C-0000-000000000009} + {564EB540-D6B6-425C-0000-00000000000A} {564EB540-D6B6-425C-0000-00000000000D} - {564EB540-D6B6-425C-0000-00000000000A} - - {564EB540-D6B6-425C-0000-00000000000B} - + {564EB540-D6B6-425C-0000-00000000000C} @@ -124,9 +118,12 @@ {564EB540-D6B6-425C-0000-000000000007} - + {564EB540-D6B6-425C-0000-000000000008} + + {564EB540-D6B6-425C-0000-000000000009} + @@ -318,9 +315,6 @@ src\messages\peer - - src\messages\rpc - src @@ -387,6 +381,9 @@ src\protocols + + src\rpc + src\sessions @@ -707,57 +704,6 @@ include\bitcoin\network\messages\peer - - include\bitcoin\network\messages\rpc - - - include\bitcoin\network\messages\rpc - - - include\bitcoin\network\messages\rpc\enums - - - include\bitcoin\network\messages\rpc\enums - - - include\bitcoin\network\messages\rpc\interfaces - - - include\bitcoin\network\messages\rpc\interfaces - - - include\bitcoin\network\messages\rpc\interfaces - - - include\bitcoin\network\messages\rpc\interfaces - - - include\bitcoin\network\messages\rpc\interfaces - - - include\bitcoin\network\messages\rpc\interfaces - - - include\bitcoin\network\messages\rpc\interfaces - - - include\bitcoin\network\messages\rpc\interfaces - - - include\bitcoin\network\messages\rpc - - - include\bitcoin\network\messages\rpc - - - include\bitcoin\network\messages\rpc - - - include\bitcoin\network\messages\rpc - - - include\bitcoin\network\messages\rpc - include\bitcoin\network @@ -836,6 +782,57 @@ include\bitcoin\network\protocols + + include\bitcoin\network\rpc + + + include\bitcoin\network\rpc + + + include\bitcoin\network\rpc\enums + + + include\bitcoin\network\rpc\enums + + + include\bitcoin\network\rpc\interfaces + + + include\bitcoin\network\rpc\interfaces + + + include\bitcoin\network\rpc\interfaces + + + include\bitcoin\network\rpc\interfaces + + + include\bitcoin\network\rpc\interfaces + + + include\bitcoin\network\rpc\interfaces + + + include\bitcoin\network\rpc\interfaces + + + include\bitcoin\network\rpc\interfaces + + + include\bitcoin\network\rpc + + + include\bitcoin\network\rpc + + + include\bitcoin\network\rpc + + + include\bitcoin\network\rpc + + + include\bitcoin\network\rpc + include\bitcoin\network\sessions @@ -895,8 +892,8 @@ include\bitcoin\network\impl\async - - include\bitcoin\network\impl\messages\rpc + + include\bitcoin\network\impl\rpc diff --git a/include/bitcoin/network.hpp b/include/bitcoin/network.hpp index 75d56fdcc..33b3e9e1c 100644 --- a/include/bitcoin/network.hpp +++ b/include/bitcoin/network.hpp @@ -115,23 +115,6 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include @@ -157,6 +140,23 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/include/bitcoin/network/channels/channel_http.hpp b/include/bitcoin/network/channels/channel_http.hpp index 40f146a52..c01489b05 100644 --- a/include/bitcoin/network/channels/channel_http.hpp +++ b/include/bitcoin/network/channels/channel_http.hpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include namespace libbitcoin { diff --git a/include/bitcoin/network/channels/channel_peer.hpp b/include/bitcoin/network/channels/channel_peer.hpp index 805e009e3..d16bbe59c 100644 --- a/include/bitcoin/network/channels/channel_peer.hpp +++ b/include/bitcoin/network/channels/channel_peer.hpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include namespace libbitcoin { namespace network { diff --git a/include/bitcoin/network/impl/messages/rpc/dispatcher.ipp b/include/bitcoin/network/impl/rpc/dispatcher.ipp similarity index 97% rename from include/bitcoin/network/impl/messages/rpc/dispatcher.ipp rename to include/bitcoin/network/impl/rpc/dispatcher.ipp index 4d78c1c8a..0777e0b4d 100644 --- a/include/bitcoin/network/impl/messages/rpc/dispatcher.ipp +++ b/include/bitcoin/network/impl/rpc/dispatcher.ipp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_DISPATCHER_IPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_DISPATCHER_IPP +#ifndef LIBBITCOIN_NETWORK_RPC_DISPATCHER_IPP +#define LIBBITCOIN_NETWORK_RPC_DISPATCHER_IPP #include #include @@ -25,9 +25,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include namespace libbitcoin { namespace network { diff --git a/include/bitcoin/network/messages/rpc/any.hpp b/include/bitcoin/network/rpc/any.hpp similarity index 97% rename from include/bitcoin/network/messages/rpc/any.hpp rename to include/bitcoin/network/rpc/any.hpp index e41782f68..087dc2a8b 100644 --- a/include/bitcoin/network/messages/rpc/any.hpp +++ b/include/bitcoin/network/rpc/any.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_ANY_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_ANY_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_ANY_HPP +#define LIBBITCOIN_NETWORK_RPC_ANY_HPP #include #include diff --git a/include/bitcoin/network/messages/rpc/dispatcher.hpp b/include/bitcoin/network/rpc/dispatcher.hpp similarity index 95% rename from include/bitcoin/network/messages/rpc/dispatcher.hpp rename to include/bitcoin/network/rpc/dispatcher.hpp index 73916f1f3..84e5669ba 100644 --- a/include/bitcoin/network/messages/rpc/dispatcher.hpp +++ b/include/bitcoin/network/rpc/dispatcher.hpp @@ -16,15 +16,15 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_DISPATCHER_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_DISPATCHER_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_DISPATCHER_HPP +#define LIBBITCOIN_NETWORK_RPC_DISPATCHER_HPP #include #include #include #include -#include -#include +#include +#include namespace libbitcoin { namespace network { @@ -146,7 +146,7 @@ class dispatcher #define TEMPLATE template #define CLASS dispatcher -#include +#include #undef CLASS #undef TEMPLATE diff --git a/include/bitcoin/network/messages/rpc/enums/grouping.hpp b/include/bitcoin/network/rpc/enums/grouping.hpp similarity index 91% rename from include/bitcoin/network/messages/rpc/enums/grouping.hpp rename to include/bitcoin/network/rpc/enums/grouping.hpp index cc217836b..c8b1a874b 100644 --- a/include/bitcoin/network/messages/rpc/enums/grouping.hpp +++ b/include/bitcoin/network/rpc/enums/grouping.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_ENUMS_GROUPING_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_ENUMS_GROUPING_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_ENUMS_GROUPING_HPP +#define LIBBITCOIN_NETWORK_RPC_ENUMS_GROUPING_HPP #include diff --git a/include/bitcoin/network/messages/rpc/enums/version.hpp b/include/bitcoin/network/rpc/enums/version.hpp similarity index 91% rename from include/bitcoin/network/messages/rpc/enums/version.hpp rename to include/bitcoin/network/rpc/enums/version.hpp index d9a6d9e97..97c68a74b 100644 --- a/include/bitcoin/network/messages/rpc/enums/version.hpp +++ b/include/bitcoin/network/rpc/enums/version.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_ENUMS_VERSION_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_ENUMS_VERSION_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_ENUMS_VERSION_HPP +#define LIBBITCOIN_NETWORK_RPC_ENUMS_VERSION_HPP #include diff --git a/include/bitcoin/network/messages/rpc/interfaces/bitcoind.hpp b/include/bitcoin/network/rpc/interfaces/bitcoind.hpp similarity index 98% rename from include/bitcoin/network/messages/rpc/interfaces/bitcoind.hpp rename to include/bitcoin/network/rpc/interfaces/bitcoind.hpp index d651bb91d..d8ddaa277 100644 --- a/include/bitcoin/network/messages/rpc/interfaces/bitcoind.hpp +++ b/include/bitcoin/network/rpc/interfaces/bitcoind.hpp @@ -16,12 +16,12 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_BITCOIND_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_BITCOIND_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_INTERFACES_BITCOIND_HPP +#define LIBBITCOIN_NETWORK_RPC_INTERFACES_BITCOIND_HPP #include #include -#include +#include namespace libbitcoin { namespace network { diff --git a/include/bitcoin/network/messages/rpc/interfaces/electrum.hpp b/include/bitcoin/network/rpc/interfaces/electrum.hpp similarity index 95% rename from include/bitcoin/network/messages/rpc/interfaces/electrum.hpp rename to include/bitcoin/network/rpc/interfaces/electrum.hpp index f3e7ddbfe..e0d6b3a08 100644 --- a/include/bitcoin/network/messages/rpc/interfaces/electrum.hpp +++ b/include/bitcoin/network/rpc/interfaces/electrum.hpp @@ -16,12 +16,12 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_ELECTRUM_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_ELECTRUM_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_INTERFACES_ELECTRUM_HPP +#define LIBBITCOIN_NETWORK_RPC_INTERFACES_ELECTRUM_HPP #include #include -#include +#include namespace libbitcoin { namespace network { diff --git a/include/bitcoin/network/messages/rpc/interfaces/explore.hpp b/include/bitcoin/network/rpc/interfaces/explore.hpp similarity index 96% rename from include/bitcoin/network/messages/rpc/interfaces/explore.hpp rename to include/bitcoin/network/rpc/interfaces/explore.hpp index 9e388eaed..56dcba84c 100644 --- a/include/bitcoin/network/messages/rpc/interfaces/explore.hpp +++ b/include/bitcoin/network/rpc/interfaces/explore.hpp @@ -16,12 +16,12 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_EXPLORE_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_EXPLORE_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_INTERFACES_EXPLORE_HPP +#define LIBBITCOIN_NETWORK_RPC_INTERFACES_EXPLORE_HPP #include #include -#include +#include namespace libbitcoin { namespace network { diff --git a/include/bitcoin/network/messages/rpc/interfaces/http.hpp b/include/bitcoin/network/rpc/interfaces/http.hpp similarity index 91% rename from include/bitcoin/network/messages/rpc/interfaces/http.hpp rename to include/bitcoin/network/rpc/interfaces/http.hpp index 31da5f74b..574a198a8 100644 --- a/include/bitcoin/network/messages/rpc/interfaces/http.hpp +++ b/include/bitcoin/network/rpc/interfaces/http.hpp @@ -16,13 +16,13 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_HTTP_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_HTTP_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_INTERFACES_HTTP_HPP +#define LIBBITCOIN_NETWORK_RPC_INTERFACES_HTTP_HPP #include #include #include -#include +#include namespace libbitcoin { namespace network { diff --git a/include/bitcoin/network/messages/rpc/interfaces/interfaces.hpp b/include/bitcoin/network/rpc/interfaces/interfaces.hpp similarity index 70% rename from include/bitcoin/network/messages/rpc/interfaces/interfaces.hpp rename to include/bitcoin/network/rpc/interfaces/interfaces.hpp index b79506c7e..82729464d 100644 --- a/include/bitcoin/network/messages/rpc/interfaces/interfaces.hpp +++ b/include/bitcoin/network/rpc/interfaces/interfaces.hpp @@ -16,16 +16,16 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_INTERFACES_HPP +#define LIBBITCOIN_NETWORK_RPC_INTERFACES_HPP -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include namespace libbitcoin { namespace network { diff --git a/include/bitcoin/network/messages/rpc/interfaces/peer.hpp b/include/bitcoin/network/rpc/interfaces/peer.hpp similarity index 97% rename from include/bitcoin/network/messages/rpc/interfaces/peer.hpp rename to include/bitcoin/network/rpc/interfaces/peer.hpp index 9ea24265b..dcced6622 100644 --- a/include/bitcoin/network/messages/rpc/interfaces/peer.hpp +++ b/include/bitcoin/network/rpc/interfaces/peer.hpp @@ -16,13 +16,13 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_PEER_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_PEER_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_INTERFACES_PEER_HPP +#define LIBBITCOIN_NETWORK_RPC_INTERFACES_PEER_HPP #include #include #include -#include +#include namespace libbitcoin { namespace network { diff --git a/include/bitcoin/network/messages/rpc/interfaces/stratum_v1.hpp b/include/bitcoin/network/rpc/interfaces/stratum_v1.hpp similarity index 93% rename from include/bitcoin/network/messages/rpc/interfaces/stratum_v1.hpp rename to include/bitcoin/network/rpc/interfaces/stratum_v1.hpp index d996838eb..2718b75c5 100644 --- a/include/bitcoin/network/messages/rpc/interfaces/stratum_v1.hpp +++ b/include/bitcoin/network/rpc/interfaces/stratum_v1.hpp @@ -16,12 +16,12 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_STRATUM_V1_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_STRATUM_V1_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_INTERFACES_STRATUM_V1_HPP +#define LIBBITCOIN_NETWORK_RPC_INTERFACES_STRATUM_V1_HPP #include #include -#include +#include namespace libbitcoin { namespace network { diff --git a/include/bitcoin/network/messages/rpc/interfaces/stratum_v2.hpp b/include/bitcoin/network/rpc/interfaces/stratum_v2.hpp similarity index 96% rename from include/bitcoin/network/messages/rpc/interfaces/stratum_v2.hpp rename to include/bitcoin/network/rpc/interfaces/stratum_v2.hpp index 4db7435d1..1b5fec468 100644 --- a/include/bitcoin/network/messages/rpc/interfaces/stratum_v2.hpp +++ b/include/bitcoin/network/rpc/interfaces/stratum_v2.hpp @@ -16,12 +16,12 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_STRATUM_V2_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_INTERFACES_STRATUM_V2_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_INTERFACES_STRATUM_V2_HPP +#define LIBBITCOIN_NETWORK_RPC_INTERFACES_STRATUM_V2_HPP #include #include -#include +#include namespace libbitcoin { namespace network { diff --git a/include/bitcoin/network/messages/rpc/method.hpp b/include/bitcoin/network/rpc/method.hpp similarity index 95% rename from include/bitcoin/network/messages/rpc/method.hpp rename to include/bitcoin/network/rpc/method.hpp index 2fedcbc8c..fed3bfb2f 100644 --- a/include/bitcoin/network/messages/rpc/method.hpp +++ b/include/bitcoin/network/rpc/method.hpp @@ -16,14 +16,14 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_METHOD_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_METHOD_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_METHOD_HPP +#define LIBBITCOIN_NETWORK_RPC_METHOD_HPP #include #include #include #include -#include +#include namespace libbitcoin { namespace network { diff --git a/include/bitcoin/network/messages/rpc/model.hpp b/include/bitcoin/network/rpc/model.hpp similarity index 96% rename from include/bitcoin/network/messages/rpc/model.hpp rename to include/bitcoin/network/rpc/model.hpp index c26f3beac..327ca5db4 100644 --- a/include/bitcoin/network/messages/rpc/model.hpp +++ b/include/bitcoin/network/rpc/model.hpp @@ -16,16 +16,16 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_MODEL_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_MODEL_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_MODEL_HPP +#define LIBBITCOIN_NETWORK_RPC_MODEL_HPP #include #include #include #include #include -#include -#include +#include +#include namespace libbitcoin { namespace network { diff --git a/include/bitcoin/network/messages/rpc/publish.hpp b/include/bitcoin/network/rpc/publish.hpp similarity index 86% rename from include/bitcoin/network/messages/rpc/publish.hpp rename to include/bitcoin/network/rpc/publish.hpp index 0a71edc61..cd79befa5 100644 --- a/include/bitcoin/network/messages/rpc/publish.hpp +++ b/include/bitcoin/network/rpc/publish.hpp @@ -16,14 +16,14 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_PUBLISH_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_PUBLISH_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_PUBLISH_HPP +#define LIBBITCOIN_NETWORK_RPC_PUBLISH_HPP #include #include #include -#include -#include +#include +#include namespace libbitcoin { namespace network { diff --git a/include/bitcoin/network/messages/rpc/rpc.hpp b/include/bitcoin/network/rpc/rpc.hpp similarity index 57% rename from include/bitcoin/network/messages/rpc/rpc.hpp rename to include/bitcoin/network/rpc/rpc.hpp index 07b1af979..c4c91cbac 100644 --- a/include/bitcoin/network/messages/rpc/rpc.hpp +++ b/include/bitcoin/network/rpc/rpc.hpp @@ -16,17 +16,17 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_RPC_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_RPC_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_RPC_HPP +#define LIBBITCOIN_NETWORK_RPC_RPC_HPP -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #endif diff --git a/include/bitcoin/network/messages/rpc/types.hpp b/include/bitcoin/network/rpc/types.hpp similarity index 98% rename from include/bitcoin/network/messages/rpc/types.hpp rename to include/bitcoin/network/rpc/types.hpp index 83c1a2373..960041aca 100644 --- a/include/bitcoin/network/messages/rpc/types.hpp +++ b/include/bitcoin/network/rpc/types.hpp @@ -16,13 +16,13 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#ifndef LIBBITCOIN_NETWORK_MESSAGES_RPC_TYPES_HPP -#define LIBBITCOIN_NETWORK_MESSAGES_RPC_TYPES_HPP +#ifndef LIBBITCOIN_NETWORK_RPC_TYPES_HPP +#define LIBBITCOIN_NETWORK_RPC_TYPES_HPP #include #include #include -#include +#include namespace libbitcoin { namespace network { diff --git a/src/channels/channel_http.cpp b/src/channels/channel_http.cpp index 81b02fae9..be160c7c0 100644 --- a/src/channels/channel_http.cpp +++ b/src/channels/channel_http.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include namespace libbitcoin { namespace network { diff --git a/src/messages/rpc/model.cpp b/src/rpc/model.cpp similarity index 98% rename from src/messages/rpc/model.cpp rename to src/rpc/model.cpp index 284208bdd..c004ee759 100644 --- a/src/messages/rpc/model.cpp +++ b/src/rpc/model.cpp @@ -16,11 +16,11 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#include +#include #include #include -#include +#include // boost::json parse/seralize is not exception safe. diff --git a/test/messages/http/method.cpp b/test/messages/http/method.cpp index 402019a03..a536573bf 100644 --- a/test/messages/http/method.cpp +++ b/test/messages/http/method.cpp @@ -18,7 +18,7 @@ */ #include "../../test.hpp" -BOOST_AUTO_TEST_SUITE(method_tests) +BOOST_AUTO_TEST_SUITE(http_method_tests) using namespace network::http::method; diff --git a/test/messages/rpc/any.cpp b/test/rpc/any.cpp similarity index 98% rename from test/messages/rpc/any.cpp rename to test/rpc/any.cpp index 5f5903d8a..617b603ac 100644 --- a/test/messages/rpc/any.cpp +++ b/test/rpc/any.cpp @@ -16,9 +16,9 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#include "../../test.hpp" +#include "../test.hpp" -BOOST_AUTO_TEST_SUITE(rpc_any_tests) +BOOST_AUTO_TEST_SUITE(any_tests) using namespace rpc; diff --git a/test/messages/rpc/dispatcher.cpp b/test/rpc/dispatcher.cpp similarity index 99% rename from test/messages/rpc/dispatcher.cpp rename to test/rpc/dispatcher.cpp index 7f4fb48b2..d303e18d5 100644 --- a/test/messages/rpc/dispatcher.cpp +++ b/test/rpc/dispatcher.cpp @@ -16,7 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#include "../../test.hpp" +#include "../test.hpp" BOOST_AUTO_TEST_SUITE(dispatcher_tests) diff --git a/test/messages/rpc/method.cpp b/test/rpc/method.cpp similarity index 97% rename from test/messages/rpc/method.cpp rename to test/rpc/method.cpp index 3e9fa5597..380910e13 100644 --- a/test/messages/rpc/method.cpp +++ b/test/rpc/method.cpp @@ -16,12 +16,10 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#include "../../test.hpp" +#include "../test.hpp" #include -BOOST_AUTO_TEST_SUITE(rpc_method_tests) - using namespace rpc; // setup @@ -105,5 +103,3 @@ static_assert(is_same_type>, std::array>, std::array>); static_assert(is_same_type>, std::array>); - -BOOST_AUTO_TEST_SUITE_END() diff --git a/test/messages/rpc/types.cpp b/test/rpc/types.cpp similarity index 99% rename from test/messages/rpc/types.cpp rename to test/rpc/types.cpp index 32d24275a..8f65a94a0 100644 --- a/test/messages/rpc/types.cpp +++ b/test/rpc/types.cpp @@ -16,9 +16,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -#include "../../test.hpp" - -BOOST_AUTO_TEST_SUITE(rpc_types_tests) +#include "../test.hpp" using namespace rpc; @@ -282,5 +280,3 @@ static_assert( is_tagged, std::string, bool>>); static_assert(is_same_tuple>, std::tuple>); static_assert(is_same_tuple>, std::tuple>); - -BOOST_AUTO_TEST_SUITE_END() From 8418a9bc0e7d2254354befe9a71391f057c2f211 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Mon, 24 Nov 2025 12:30:38 -0500 Subject: [PATCH 2/3] rpc documentation. --- include/bitcoin/network/rpc/any.hpp | 1 + include/bitcoin/network/rpc/dispatcher.hpp | 7 +++++- include/bitcoin/network/rpc/method.hpp | 25 ++++++++++++++++------ include/bitcoin/network/rpc/model.hpp | 4 ++++ include/bitcoin/network/rpc/publish.hpp | 4 +++- include/bitcoin/network/rpc/types.hpp | 3 +++ 6 files changed, 35 insertions(+), 9 deletions(-) diff --git a/include/bitcoin/network/rpc/any.hpp b/include/bitcoin/network/rpc/any.hpp index 087dc2a8b..d3c857568 100644 --- a/include/bitcoin/network/rpc/any.hpp +++ b/include/bitcoin/network/rpc/any.hpp @@ -30,6 +30,7 @@ namespace rpc { BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT) +/// Used in model to support dispatch of complex objects. /// Similar to std::any, but preserves fixed stack size through shared_ptr. /// This allows it to participate in a std::variant type without inflation. /// Also differs in that a move will fully remove the original inner object. diff --git a/include/bitcoin/network/rpc/dispatcher.hpp b/include/bitcoin/network/rpc/dispatcher.hpp index 84e5669ba..283430e61 100644 --- a/include/bitcoin/network/rpc/dispatcher.hpp +++ b/include/bitcoin/network/rpc/dispatcher.hpp @@ -30,7 +30,12 @@ namespace libbitcoin { namespace network { namespace rpc { -/// Not thread safe. +/// Dispatches notifications to subscriber(s) of the method signature implied +/// by request. Subscribers and dispatch functors are fully defined at compile +/// time by the Interface template argument. The request_t parameter is the +/// request side of the rpc model. Requests are run-time generated (i.e. from +/// deserialization) and the request implies a signature that must match that +/// of one subscriber. Otherwise an error is returned from notify(request). template class dispatcher { diff --git a/include/bitcoin/network/rpc/method.hpp b/include/bitcoin/network/rpc/method.hpp index fed3bfb2f..41213f9e2 100644 --- a/include/bitcoin/network/rpc/method.hpp +++ b/include/bitcoin/network/rpc/method.hpp @@ -32,6 +32,22 @@ namespace rpc { BC_PUSH_WARNING(NO_ARRAY_TO_POINTER_DECAY) /// Defines methods assignable to an rpc interface. +/// Each method must have a unique signature in the scope of the interface. The +/// method name is not part of the signature and is used only for dispatch, not +/// for subscription. Dispatch is weakly-typed to the name, where the notify +/// call maps to a functor and thereby imposes the signature requirement on the +/// request. Subscriptions are strongly-typed by argument signature alone. +/// Therefore, all signatures must be unique, which imposes a convention-based +/// restriction on method signatures. If a method signature contains a first +/// argument of type std::shared_ptr it is considered "native". The type `T` +/// must be unique for each native method in the interface. Otherwise the +/// dispatcher<> imposes a requirement that the first argument type is that of +/// the method itself (ie. the method::tag). This argument is required in the +/// handler signature, is defaulted upone notify, and is not part of a request, +/// as the request is matched by method name. This allows two methods to have +/// the same public signature while being bound by a unqiue argument list. The +/// notifier always injects a code as the zeroth argument. This must also be +/// provided by the method handler. So a minimal handler always has two args. template struct method { @@ -45,7 +61,7 @@ struct method using args = iif>; using names = std::array; - /// Required for construction of tag{}. + /// Required for construction of tag{} and passage of default value. inline constexpr method() NOEXCEPT : names_{} { @@ -68,7 +84,7 @@ struct method const names names_; }; -/// Helpers dependent upon method. +/// Type helpers required by dispatcher<> and dependent upon method. /// --------------------------------------------------------------------------- template @@ -113,11 +129,6 @@ using tag_t = typename Method::tag; template using method_t = std::tuple_element_t; -/// subscribers_t -/// --------------------------------------------------------------------------- - - - BC_POP_WARNING() } // namespace rpc diff --git a/include/bitcoin/network/rpc/model.hpp b/include/bitcoin/network/rpc/model.hpp index 327ca5db4..694550cf0 100644 --- a/include/bitcoin/network/rpc/model.hpp +++ b/include/bitcoin/network/rpc/model.hpp @@ -31,6 +31,10 @@ namespace libbitcoin { namespace network { namespace rpc { +/// This is a document object model for extended json-rpc. +/// Extensions consist of int#_t, uint#_t, and any_t types. +/// any_t accepts shared_ptr and exposes shared_ptr via dispatcher<>. + /// Forward declaration for array_t/object_t. struct value_t; diff --git a/include/bitcoin/network/rpc/publish.hpp b/include/bitcoin/network/rpc/publish.hpp index cd79befa5..20d88453b 100644 --- a/include/bitcoin/network/rpc/publish.hpp +++ b/include/bitcoin/network/rpc/publish.hpp @@ -28,7 +28,9 @@ namespace libbitcoin { namespace network { namespace rpc { - + +/// Methods are a std::tuple of rpc::method. +/// Defines a published interface for use with rpc::dispatcher<>. template struct publish : public Methods diff --git a/include/bitcoin/network/rpc/types.hpp b/include/bitcoin/network/rpc/types.hpp index 960041aca..2e3a46183 100644 --- a/include/bitcoin/network/rpc/types.hpp +++ b/include/bitcoin/network/rpc/types.hpp @@ -28,6 +28,9 @@ namespace libbitcoin { namespace network { namespace rpc { +/// Type helpers required by dispatcher. +/// --------------------------------------------------------------------------- + /// optional<> /// --------------------------------------------------------------------------- From 83483a43a2b3abd766752b541245122c95839e10 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Mon, 24 Nov 2025 12:41:51 -0500 Subject: [PATCH 3/3] Stub in http request, response, head. --- Makefile.am | 3 ++ .../libbitcoin-network.vcxproj | 3 ++ .../libbitcoin-network.vcxproj.filters | 9 +++++ include/bitcoin/network.hpp | 3 ++ .../bitcoin/network/messages/http/head.hpp | 33 +++++++++++++++++++ .../bitcoin/network/messages/http/http.hpp | 3 ++ .../bitcoin/network/messages/http/request.hpp | 33 +++++++++++++++++++ .../network/messages/http/response.hpp | 33 +++++++++++++++++++ 8 files changed, 120 insertions(+) create mode 100644 include/bitcoin/network/messages/http/head.hpp create mode 100644 include/bitcoin/network/messages/http/request.hpp create mode 100644 include/bitcoin/network/messages/http/response.hpp diff --git a/Makefile.am b/Makefile.am index 0dc4ee474..202c9b91a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -349,8 +349,11 @@ include_bitcoin_network_messages_httpdir = ${includedir}/bitcoin/network/message include_bitcoin_network_messages_http_HEADERS = \ include/bitcoin/network/messages/http/body.hpp \ include/bitcoin/network/messages/http/fields.hpp \ + include/bitcoin/network/messages/http/head.hpp \ include/bitcoin/network/messages/http/http.hpp \ include/bitcoin/network/messages/http/method.hpp \ + include/bitcoin/network/messages/http/request.hpp \ + include/bitcoin/network/messages/http/response.hpp \ include/bitcoin/network/messages/http/types.hpp include_bitcoin_network_messages_http_enumsdir = ${includedir}/bitcoin/network/messages/http/enums diff --git a/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj b/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj index 5db77f53a..861337ebd 100644 --- a/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj +++ b/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj @@ -272,8 +272,11 @@ + + + diff --git a/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj.filters b/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj.filters index 53dd738a3..a63aa69e6 100644 --- a/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj.filters +++ b/builds/msvc/vs2022/libbitcoin-network/libbitcoin-network.vcxproj.filters @@ -551,12 +551,21 @@ include\bitcoin\network\messages\http + + include\bitcoin\network\messages\http + include\bitcoin\network\messages\http include\bitcoin\network\messages\http + + include\bitcoin\network\messages\http + + + include\bitcoin\network\messages\http + include\bitcoin\network\messages\http diff --git a/include/bitcoin/network.hpp b/include/bitcoin/network.hpp index 33b3e9e1c..af55cf6a3 100644 --- a/include/bitcoin/network.hpp +++ b/include/bitcoin/network.hpp @@ -59,8 +59,11 @@ #include #include #include +#include #include #include +#include +#include #include #include #include diff --git a/include/bitcoin/network/messages/http/head.hpp b/include/bitcoin/network/messages/http/head.hpp new file mode 100644 index 000000000..04ba59ef4 --- /dev/null +++ b/include/bitcoin/network/messages/http/head.hpp @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) + * + * This file is part of libbitcoin. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#ifndef LIBBITCOIN_NETWORK_MESSAGES_HTTP_HEAD_HPP +#define LIBBITCOIN_NETWORK_MESSAGES_HTTP_HEAD_HPP + +#include +#include + +namespace libbitcoin { +namespace network { +namespace http { + +} // namespace http +} // namespace network +} // namespace libbitcoin + +#endif diff --git a/include/bitcoin/network/messages/http/http.hpp b/include/bitcoin/network/messages/http/http.hpp index d12880f28..4b5e05818 100644 --- a/include/bitcoin/network/messages/http/http.hpp +++ b/include/bitcoin/network/messages/http/http.hpp @@ -26,7 +26,10 @@ #include #include #include +#include #include +#include +#include #include #endif diff --git a/include/bitcoin/network/messages/http/request.hpp b/include/bitcoin/network/messages/http/request.hpp new file mode 100644 index 000000000..6e1173b06 --- /dev/null +++ b/include/bitcoin/network/messages/http/request.hpp @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) + * + * This file is part of libbitcoin. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#ifndef LIBBITCOIN_NETWORK_MESSAGES_HTTP_REQUEST_HPP +#define LIBBITCOIN_NETWORK_MESSAGES_HTTP_REQUEST_HPP + +#include +#include + +namespace libbitcoin { +namespace network { +namespace http { + +} // namespace http +} // namespace network +} // namespace libbitcoin + +#endif diff --git a/include/bitcoin/network/messages/http/response.hpp b/include/bitcoin/network/messages/http/response.hpp new file mode 100644 index 000000000..74eae8530 --- /dev/null +++ b/include/bitcoin/network/messages/http/response.hpp @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) + * + * This file is part of libbitcoin. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +#ifndef LIBBITCOIN_NETWORK_MESSAGES_HTTP_RESPONSE_HPP +#define LIBBITCOIN_NETWORK_MESSAGES_HTTP_RESPONSE_HPP + +#include +#include + +namespace libbitcoin { +namespace network { +namespace http { + +} // namespace http +} // namespace network +} // namespace libbitcoin + +#endif