blob: df3367c0310b7a8f6cdb2f16eb00f87528e09631 [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
Adrien Béraud6de3f882023-07-06 12:56:29 -040023#include <functional>
24#include <memory>
25#include <vector>
26
Adrien Béraud9e0f84f2023-07-27 16:02:21 -040027extern "C" {
28#include <pjnath.h>
29#include <pjlib.h>
30#include <pjlib-util.h>
31}
32
Adrien Béraud1ae60aa2023-07-07 09:55:09 -040033namespace dhtnet {
Adrien Béraud6de3f882023-07-06 12:56:29 -040034
35class IceTransportFactory
36{
37public:
Adrien Béraud89933c12023-07-26 14:53:30 -040038 IceTransportFactory(const std::shared_ptr<Logger>& logger = {});
Adrien Béraud6de3f882023-07-06 12:56:29 -040039 ~IceTransportFactory();
40
41 std::shared_ptr<IceTransport> createTransport(std::string_view name);
42
43 std::unique_ptr<IceTransport> createUTransport(std::string_view name);
44
45 /**
46 * PJSIP specifics
47 */
48 pj_ice_strans_cfg getIceCfg() const { return ice_cfg_; }
49 pj_pool_factory* getPoolFactory() { return &cp_->factory; }
50 std::shared_ptr<pj_caching_pool> getPoolCaching() { return cp_; }
51
52private:
53 std::shared_ptr<pj_caching_pool> cp_;
54 pj_ice_strans_cfg ice_cfg_;
Adrien Béraud89933c12023-07-26 14:53:30 -040055 std::shared_ptr<Logger> logger_ {};
Adrien Béraud6de3f882023-07-06 12:56:29 -040056};
57
58}; // namespace jami