Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ src_libbitcoin_node_la_SOURCES = \
src/protocols/protocol_performer.cpp \
src/protocols/protocol_transaction_in_106.cpp \
src/protocols/protocol_transaction_out_106.cpp \
src/rest/rest.cpp \
src/rest/media.cpp \
src/rest/parse.cpp \
src/sessions/session.cpp \
src/sessions/session_inbound.cpp \
src/sessions/session_manual.cpp \
Expand Down Expand Up @@ -107,7 +108,8 @@ test_libbitcoin_node_test_SOURCES = \
test/chasers/chaser_transaction.cpp \
test/chasers/chaser_validate.cpp \
test/protocols/protocol.cpp \
test/rest/rest.cpp \
test/rest/media.cpp \
test/rest/parse.cpp \
test/sessions/session.cpp

endif WITH_TESTS
Expand Down Expand Up @@ -229,7 +231,8 @@ include_bitcoin_node_protocols_HEADERS = \

include_bitcoin_node_restdir = ${includedir}/bitcoin/node/rest
include_bitcoin_node_rest_HEADERS = \
include/bitcoin/node/rest/rest.hpp
include/bitcoin/node/rest/media.hpp \
include/bitcoin/node/rest/parse.hpp

include_bitcoin_node_sessionsdir = ${includedir}/bitcoin/node/sessions
include_bitcoin_node_sessions_HEADERS = \
Expand Down
6 changes: 4 additions & 2 deletions builds/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ add_library( ${CANONICAL_LIB_NAME}
"../../src/protocols/protocol_performer.cpp"
"../../src/protocols/protocol_transaction_in_106.cpp"
"../../src/protocols/protocol_transaction_out_106.cpp"
"../../src/rest/rest.cpp"
"../../src/rest/media.cpp"
"../../src/rest/parse.cpp"
"../../src/sessions/session.cpp"
"../../src/sessions/session_inbound.cpp"
"../../src/sessions/session_manual.cpp"
Expand Down Expand Up @@ -349,7 +350,8 @@ if (with-tests)
"../../test/chasers/chaser_transaction.cpp"
"../../test/chasers/chaser_validate.cpp"
"../../test/protocols/protocol.cpp"
"../../test/rest/rest.cpp"
"../../test/rest/media.cpp"
"../../test/rest/parse.cpp"
"../../test/sessions/session.cpp" )

add_test( NAME libbitcoin-node-test COMMAND libbitcoin-node-test
Expand Down
1 change: 1 addition & 0 deletions builds/msvc/vs2022/libbitcoin-network.import.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\..\libbitcoin-network\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions Condition="'$(Linkage-libbitcoin-network)' == 'static' Or '$(Linkage-libbitcoin-network)' == 'ltcg'">BCT_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@
<ClCompile Include="..\..\..\..\test\main.cpp" />
<ClCompile Include="..\..\..\..\test\node.cpp" />
<ClCompile Include="..\..\..\..\test\protocols\protocol.cpp" />
<ClCompile Include="..\..\..\..\test\rest\rest.cpp" />
<ClCompile Include="..\..\..\..\test\rest\media.cpp" />
<ClCompile Include="..\..\..\..\test\rest\parse.cpp" />
<ClCompile Include="..\..\..\..\test\sessions\session.cpp" />
<ClCompile Include="..\..\..\..\test\settings.cpp" />
<ClCompile Include="..\..\..\..\test\test.cpp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@
<ClCompile Include="..\..\..\..\test\protocols\protocol.cpp">
<Filter>src\protocols</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\rest\rest.cpp">
<ClCompile Include="..\..\..\..\test\rest\media.cpp">
<Filter>src\rest</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\rest\parse.cpp">
<Filter>src\rest</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\sessions\session.cpp">
Expand Down
6 changes: 4 additions & 2 deletions builds/msvc/vs2022/libbitcoin-node/libbitcoin-node.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@
<ClCompile Include="..\..\..\..\src\protocols\protocol_performer.cpp" />
<ClCompile Include="..\..\..\..\src\protocols\protocol_transaction_in_106.cpp" />
<ClCompile Include="..\..\..\..\src\protocols\protocol_transaction_out_106.cpp" />
<ClCompile Include="..\..\..\..\src\rest\rest.cpp" />
<ClCompile Include="..\..\..\..\src\rest\media.cpp" />
<ClCompile Include="..\..\..\..\src\rest\parse.cpp" />
<ClCompile Include="..\..\..\..\src\sessions\session.cpp" />
<ClCompile Include="..\..\..\..\src\sessions\session_inbound.cpp" />
<ClCompile Include="..\..\..\..\src\sessions\session_manual.cpp" />
Expand Down Expand Up @@ -218,7 +219,8 @@
<ClInclude Include="..\..\..\..\include\bitcoin\node\protocols\protocol_web.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\protocols\protocol_ws.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\protocols\protocols.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\rest\rest.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\rest\media.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\rest\parse.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\sessions\session.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\sessions\session_inbound.hpp" />
<ClInclude Include="..\..\..\..\include\bitcoin\node\sessions\session_manual.hpp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@
<ClCompile Include="..\..\..\..\src\protocols\protocol_transaction_out_106.cpp">
<Filter>src\protocols</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\rest\rest.cpp">
<ClCompile Include="..\..\..\..\src\rest\media.cpp">
<Filter>src\rest</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\rest\parse.cpp">
<Filter>src\rest</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\sessions\session.cpp">
Expand Down Expand Up @@ -347,7 +350,10 @@
<ClInclude Include="..\..\..\..\include\bitcoin\node\protocols\protocols.hpp">
<Filter>include\bitcoin\node\protocols</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\node\rest\rest.hpp">
<ClInclude Include="..\..\..\..\include\bitcoin\node\rest\media.hpp">
<Filter>include\bitcoin\node\rest</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\node\rest\parse.hpp">
<Filter>include\bitcoin\node\rest</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\include\bitcoin\node\sessions\session.hpp">
Expand Down
3 changes: 2 additions & 1 deletion include/bitcoin/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
#include <bitcoin/node/protocols/protocol_web.hpp>
#include <bitcoin/node/protocols/protocol_ws.hpp>
#include <bitcoin/node/protocols/protocols.hpp>
#include <bitcoin/node/rest/rest.hpp>
#include <bitcoin/node/rest/media.hpp>
#include <bitcoin/node/rest/parse.hpp>
#include <bitcoin/node/sessions/session.hpp>
#include <bitcoin/node/sessions/session_inbound.hpp>
#include <bitcoin/node/sessions/session_manual.hpp>
Expand Down
12 changes: 0 additions & 12 deletions include/bitcoin/node/protocols/protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@
namespace libbitcoin {
namespace node {

// TODO: first split node::protocol -> node::protocol and node::protocol_peer.
// TODO: then create node::protocol_peer -> node::protocol + network::protocol_peer.
// TODO: then create node::protocol_tcp -> node::protocol + network::protocol_tcp.
// TODO: this is the same pattern as joining node::session + network::session_xxxx.
// TODO: node::session_xxx => node::session_peer<network::session_xxx> : node::session.
// TODO: node::protocol_xxx => node::protocol_peer<network::protocol_xxx> : node::protocol.
// TODO: none of the node classes derive from shared_from_base and instead just
// TODO: rely on the network base class and shared_from_sibling<> to obtain
// TODO: node object methods within protocol_peer and derived, just as in
// TODO: session_peer and derived. This could be normalized using an override
// TODO: of shared_from_base<>() withing the two templates.

/// Abstract base for node protocols, thread safe.
class BCN_API protocol
{
Expand Down
6 changes: 3 additions & 3 deletions include/bitcoin/node/protocols/protocol_html.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ class BCN_API protocol_html
virtual void send_data(const network::http::request& request,
system::data_chunk&& bytes) NOEXCEPT;
virtual void send_file(const network::http::request& request,
network::http::file&& file, network::http::mime_type type) NOEXCEPT;
network::http::file&& file, network::http::media_type type) NOEXCEPT;
virtual void send_span(const network::http::request& request,
network::http::span_body::value_type&& span,
network::http::mime_type type) NOEXCEPT;
network::http::media_type type) NOEXCEPT;
virtual void send_buffer(const network::http::request& request,
network::http::buffer_body::value_type&& buffer,
network::http::mime_type type) NOEXCEPT;
network::http::media_type type) NOEXCEPT;

/// Utilities.
bool is_allowed_origin(const network::http::fields& fields,
Expand Down
33 changes: 33 additions & 0 deletions include/bitcoin/node/rest/media.hpp
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef LIBBITCOIN_NODE_MEDIA_HPP
#define LIBBITCOIN_NODE_MEDIA_HPP

#include <bitcoin/node/define.hpp>

namespace libbitcoin {
namespace node {

BCN_API bool get_acceptable_media_type(network::http::media_type& out,
const network::http::request& request) NOEXCEPT;

} // namespace network
} // namespace libbitcoin

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBBITCOIN_NODE_REST_HPP
#define LIBBITCOIN_NODE_REST_HPP
#ifndef LIBBITCOIN_NODE_PARSE_HPP
#define LIBBITCOIN_NODE_PARSE_HPP

#include <bitcoin/node/define.hpp>

namespace libbitcoin {
namespace node {

BCN_API code path_to_request(network::rpc::request_t& out,
const std::string& path) NOEXCEPT;
BCN_API code parse_request(network::rpc::request_t& out,
const std::string_view& path) NOEXCEPT;

} // namespace network
} // namespace libbitcoin
Expand Down
Loading
Loading