blob: 97c44c9ace3e396a3429ab58e76f6b369a16cff6 [file] [log] [blame]
Amna38768302023-08-21 11:51:56 -04001/*
Amna2f3539b2023-09-18 13:59:22 -04002 * Copyright (C) 2023 Savoir-faire Linux Inc.
Amna38768302023-08-21 11:51:56 -04003 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17#include <opendht/crypto.h>
Amnac75ffe92024-02-08 17:23:29 -050018#include <filesystem>
Adrien BĂ©raud6c6a9622023-08-27 12:49:31 -040019#include "connectionmanager.h"
20#include "multiplexed_socket.h"
21#include "ice_transport_factory.h"
22#include "certstore.h"
Amna38768302023-08-21 11:51:56 -040023
24namespace dhtnet {
25
Amnac03c4b52024-07-24 17:57:25 -040026#define Log(...) do { fmt::print(__VA_ARGS__); std::fflush(stdout); } while (0)
27
Amna38768302023-08-21 11:51:56 -040028using Buffer = std::shared_ptr<std::vector<uint8_t>>;
Amna2f3539b2023-09-18 13:59:22 -040029constexpr size_t BUFFER_SIZE = 64 * 1024;
Amna0e5f0762024-05-06 15:40:14 -040030
31std::filesystem::path cachePath();
Amna38768302023-08-21 11:51:56 -040032
Amna2f3539b2023-09-18 13:59:22 -040033std::unique_ptr<ConnectionManager::Config> connectionManagerConfig(
Amna2f3539b2023-09-18 13:59:22 -040034 dht::crypto::Identity identity,
35 const std::string& bootstrap,
36 std::shared_ptr<Logger> logger,
37 std::shared_ptr<tls::CertificateStore> certStore,
38 std::shared_ptr<asio::io_context> ioContext,
39 std::shared_ptr<dhtnet::IceTransportFactory> iceFactory,
40 const std::string& turn_host ="",
41 const std::string& turn_user="",
42 const std::string& turn_pass="",
43 const std::string& turn_realm="");
Amna38768302023-08-21 11:51:56 -040044// add ioContext to readFromStdin
45
Amna2f3539b2023-09-18 13:59:22 -040046template<typename T>
Amna38768302023-08-21 11:51:56 -040047void readFromPipe(std::shared_ptr<ChannelSocket> socket, T input, Buffer buffer);
48
49} // namespace dhtnet