Ring Daemon
Loading...
Searching...
No Matches
channeled_transport.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2026 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 "noncopyable.h"
21
22#include <dhtnet/multiplexed_socket.h>
23
24#include <atomic>
25#include <condition_variable>
26#include <chrono>
27#include <list>
28#include <memory>
29#include <thread>
30#include <type_traits>
31#include <utility>
32
33namespace jami {
34
35using onShutdownCb = std::function<void(void)>;
36
37namespace tls {
38
45{
46public:
48 const std::shared_ptr<dhtnet::ChannelSocket>& socket,
51
55 void start();
56
57 pjsip_transport* getTransportBase() override { return &trData_.base; }
58
59 dhtnet::IpAddr getLocalAddress() const override { return local_; }
60
61private:
63
64 // The SIP transport uses a ChannelSocket to send and receive datas
65 std::shared_ptr<dhtnet::ChannelSocket> socket_ {};
66 onShutdownCb shutdownCb_ {};
67 dhtnet::IpAddr local_ {};
68 dhtnet::IpAddr remote_ {};
69
70 // PJSIP transport backend
71 TransportData trData_ {}; // uplink to "this" (used by PJSIP called C-callbacks)
72
74 sip_utils::PoolPtr rxPool_;
75 pjsip_rx_data rdata_ {};
76
78
79 // Handle disconnected event
80 std::atomic_bool disconnected_ {false};
81};
82
83} // namespace tls
84} // namespace jami
dhtnet::IpAddr getLocalAddress() const override
void start()
Connect callbacks for channeled socket, must be done when the channel is ready to be used.
pjsip_transport * getTransportBase() override
std::unique_ptr< pj_pool_t, PoolDeleter > PoolPtr
Definition sip_utils.h:174
void emitSignal(Args... args)
Definition jami_signal.h:64
std::function< void(void)> onShutdownCb
Simple macro to hide class' copy constructor and assignment operator.
#define NON_COPYABLE(ClassName)
Definition noncopyable.h:30