blob: 03aef1019c4b69434329f0838cfd6cfdfdca0099 [file] [log] [blame]
Adrien Béraud6de3f882023-07-06 12:56:29 -04001/*
2 * Copyright (C) 2004-2023 Savoir-faire Linux Inc.
3 *
Adrien Béraudcb753622023-07-17 22:32:49 -04004 * This program is free software: you can redistribute it and/or modify
Adrien Béraud6de3f882023-07-06 12:56:29 -04005 * it under the terms of the GNU General Public License as published by
Adrien Béraudcb753622023-07-17 22:32:49 -04006 * the Free Software Foundation, either version 3 of the License, or
Adrien Béraud6de3f882023-07-06 12:56:29 -04007 * (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
Adrien Béraudcb753622023-07-17 22:32:49 -040011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Adrien Béraud6de3f882023-07-06 12:56:29 -040012 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
Adrien Béraudcb753622023-07-17 22:32:49 -040015 * along with this program. If not, see <https://www.gnu.org/licenses/>.
Adrien Béraud6de3f882023-07-06 12:56:29 -040016 */
Adrien Béraud6de3f882023-07-06 12:56:29 -040017#pragma once
18
19#include "ice_options.h"
Adrien Béraud5c93b5a2023-07-09 19:39:35 -040020#include "ice_transport.h"
Adrien Béraud6de3f882023-07-06 12:56:29 -040021#include "ip_utils.h"
22
23#include <pjnath.h>
24#include <pjlib.h>
25#include <pjlib-util.h>
26
27#include <functional>
28#include <memory>
29#include <vector>
30
Adrien Béraud1ae60aa2023-07-07 09:55:09 -040031namespace dhtnet {
Adrien Béraud6de3f882023-07-06 12:56:29 -040032
33class IceTransportFactory
34{
35public:
Adrien Béraud89933c12023-07-26 14:53:30 -040036 IceTransportFactory(const std::shared_ptr<Logger>& logger = {});
Adrien Béraud6de3f882023-07-06 12:56:29 -040037 ~IceTransportFactory();
38
39 std::shared_ptr<IceTransport> createTransport(std::string_view name);
40
41 std::unique_ptr<IceTransport> createUTransport(std::string_view name);
42
43 /**
44 * PJSIP specifics
45 */
46 pj_ice_strans_cfg getIceCfg() const { return ice_cfg_; }
47 pj_pool_factory* getPoolFactory() { return &cp_->factory; }
48 std::shared_ptr<pj_caching_pool> getPoolCaching() { return cp_; }
49
50private:
51 std::shared_ptr<pj_caching_pool> cp_;
52 pj_ice_strans_cfg ice_cfg_;
Adrien Béraud89933c12023-07-26 14:53:30 -040053 std::shared_ptr<Logger> logger_ {};
Adrien Béraud6de3f882023-07-06 12:56:29 -040054};
55
56}; // namespace jami