blob: 180207361eb2478a0185e70328f14ce468c1d9a9 [file] [log] [blame]
Adrien Bérauda1d294f2023-07-17 22:42:13 -04001/*
2 * Copyright (C) 2004-2023 Savoir-faire Linux Inc.
3 *
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#pragma once
18
19#include "ip_utils.h"
20#include "turn_params.h"
21
22#include <opendht/logger.h>
23
24#include <functional>
25#include <memory>
26#include <string>
27
28namespace dht {
29namespace log {
30class Logger;
31}
32}
33
34namespace dhtnet {
35
36using Logger = dht::log::Logger;
37
38/**
39 * This class is used to test connection to TURN servers
40 * No other logic is implemented.
41 */
42class TurnTransport
43{
44public:
45 TurnTransport(const TurnTransportParams& param, std::function<void(bool)>&& cb, const std::shared_ptr<Logger>& logger = {});
46 ~TurnTransport();
47 void shutdown();
48
49private:
50 TurnTransport() = delete;
51 class Impl;
52 std::unique_ptr<Impl> pimpl_;
53};
54
Sébastien Blin464bdff2023-07-19 08:02:53 -040055} // namespace dhtnet