Adrien Béraud | a1d294f | 2023-07-17 22:42:13 -0400 | [diff] [blame] | 1 | /* |
| 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 | |
| 28 | namespace dht { |
| 29 | namespace log { |
Adrien Béraud | 9132a81 | 2023-07-21 11:20:40 -0400 | [diff] [blame] | 30 | struct Logger; |
Adrien Béraud | a1d294f | 2023-07-17 22:42:13 -0400 | [diff] [blame] | 31 | } |
| 32 | } |
| 33 | |
| 34 | namespace dhtnet { |
| 35 | |
| 36 | using Logger = dht::log::Logger; |
| 37 | |
| 38 | /** |
| 39 | * This class is used to test connection to TURN servers |
| 40 | * No other logic is implemented. |
| 41 | */ |
| 42 | class TurnTransport |
| 43 | { |
| 44 | public: |
| 45 | TurnTransport(const TurnTransportParams& param, std::function<void(bool)>&& cb, const std::shared_ptr<Logger>& logger = {}); |
| 46 | ~TurnTransport(); |
| 47 | void shutdown(); |
| 48 | |
| 49 | private: |
| 50 | TurnTransport() = delete; |
| 51 | class Impl; |
| 52 | std::unique_ptr<Impl> pimpl_; |
| 53 | }; |
| 54 | |
Sébastien Blin | 464bdff | 2023-07-19 08:02:53 -0400 | [diff] [blame] | 55 | } // namespace dhtnet |