|
| 1 | +/** |
| 2 | + * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) |
| 3 | + * |
| 4 | + * This file is part of libbitcoin. |
| 5 | + * |
| 6 | + * This program is free software: you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU Affero General Public License as published by |
| 8 | + * the Free Software Foundation, either version 3 of the License, or |
| 9 | + * (at your option) any later version. |
| 10 | + * |
| 11 | + * This program is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + * GNU Affero General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU Affero General Public License |
| 17 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | + */ |
| 19 | +#ifndef LIBBITCOIN_NODE_PROTOCOLS_PROTOCOL_WEBSOCKET_HANDSHAKE_HPP |
| 20 | +#define LIBBITCOIN_NODE_PROTOCOLS_PROTOCOL_WEBSOCKET_HANDSHAKE_HPP |
| 21 | + |
| 22 | +#include <memory> |
| 23 | +#include <bitcoin/node/define.hpp> |
| 24 | +#include <bitcoin/node/protocols/protocol.hpp> |
| 25 | + |
| 26 | +namespace libbitcoin { |
| 27 | +namespace node { |
| 28 | + |
| 29 | +// TODO: make this an intermediate base class for websocket_handshake. |
| 30 | +// TODO: and then create a distinct concrete class for deployment. |
| 31 | +class BCN_API protocol_websocket_handshake |
| 32 | + : public network::protocol_websocket_handshake, |
| 33 | + public node::protocol, |
| 34 | + protected network::tracker<protocol_websocket_handshake> |
| 35 | +{ |
| 36 | +public: |
| 37 | + typedef std::shared_ptr<protocol_websocket_handshake> ptr; |
| 38 | + |
| 39 | + // Replace base class channel_t (network::channel_http). |
| 40 | + using channel_t = node::channel_http; |
| 41 | + |
| 42 | + protocol_websocket_handshake(const auto& session, |
| 43 | + const network::channel::ptr& channel, |
| 44 | + const options_t& options) NOEXCEPT |
| 45 | + : network::protocol_websocket_handshake(session, channel, options), |
| 46 | + node::protocol(session, channel), |
| 47 | + network::tracker<protocol_websocket_handshake>(session->log) |
| 48 | + { |
| 49 | + } |
| 50 | + |
| 51 | + /// Public start is required. |
| 52 | + void start() NOEXCEPT override |
| 53 | + { |
| 54 | + network::protocol_websocket_handshake::start(); |
| 55 | + } |
| 56 | + |
| 57 | +private: |
| 58 | + // This is thread safe. |
| 59 | + ////const options_t& options_; |
| 60 | +}; |
| 61 | + |
| 62 | +} // namespace node |
| 63 | +} // namespace libbitcoin |
| 64 | + |
| 65 | +#endif |
0 commit comments