Ring Daemon
16.0.0
Loading...
Searching...
No Matches
channeled_transport.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2004-2025 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
"
20
#include "
scheduled_executor.h
"
21
#include "
jamidht/abstract_sip_transport.h
"
22
23
#include <dhtnet/multiplexed_socket.h>
24
25
#include <atomic>
26
#include <condition_variable>
27
#include <chrono>
28
#include <list>
29
#include <memory>
30
#include <thread>
31
#include <type_traits>
32
#include <utility>
33
34
namespace
jami
{
35
36
using
onShutdownCb
= std::function<
void
(
void
)>;
37
38
namespace
tls {
39
45
class
ChanneledSIPTransport
:
public
AbstractSIPTransport
46
{
47
public
:
48
ChanneledSIPTransport
(
pjsip_endpoint
*
endpt
,
49
const
std::shared_ptr<dhtnet::ChannelSocket>& socket,
50
onShutdownCb
&&
cb
);
51
~ChanneledSIPTransport
();
52
56
void
start
();
57
58
pjsip_transport
*
getTransportBase
()
override
{
return
&trData_.
base
; }
59
60
dhtnet::IpAddr
getLocalAddress
()
const override
{
return
local_; }
61
62
private
:
63
NON_COPYABLE
(
ChanneledSIPTransport
);
64
65
// The SIP transport uses a ChannelSocket to send and receive datas
66
std::shared_ptr<dhtnet::ChannelSocket> socket_ {};
67
onShutdownCb
shutdownCb_ {};
68
dhtnet::IpAddr local_ {};
69
dhtnet::IpAddr remote_ {};
70
71
// PJSIP transport backend
72
TransportData trData_ {};
// uplink to "this" (used by PJSIP called C-callbacks)
73
74
std::unique_ptr<
pj_pool_t
,
decltype
(
pj_pool_release
)*> pool_;
75
std::unique_ptr<
pj_pool_t
,
decltype
(
pj_pool_release
)*> rxPool_;
76
pjsip_rx_data
rdata_ {};
77
78
pj_status_t
send(
pjsip_tx_data
*,
const
pj_sockaddr_t
*,
int
,
void
*,
pjsip_transport_callback
);
79
80
// Handle disconnected event
81
std::atomic_bool disconnected_ {
false
};
82
};
83
84
}
// namespace tls
85
}
// namespace jami
abstract_sip_transport.h
jami::tls::AbstractSIPTransport
AbstractSIPTransport.
Definition
abstract_sip_transport.h:35
jami::tls::ChanneledSIPTransport
ChanneledSIPTransport.
Definition
channeled_transport.h:46
jami::tls::ChanneledSIPTransport::getLocalAddress
dhtnet::IpAddr getLocalAddress() const override
Definition
channeled_transport.h:60
jami::tls::ChanneledSIPTransport::start
void start()
Connect callbacks for channeled socket, must be done when the channel is ready to be used.
Definition
channeled_transport.cpp:152
jami::tls::ChanneledSIPTransport::getTransportBase
pjsip_transport * getTransportBase() override
Definition
channeled_transport.h:58
jami::tls::ChanneledSIPTransport::~ChanneledSIPTransport
~ChanneledSIPTransport()
Definition
channeled_transport.cpp:192
jami
Definition
account.cpp:61
jami::emitSignal
void emitSignal(Args... args)
Definition
ring_signal.h:64
jami::onShutdownCb
std::function< void(void)> onShutdownCb
Definition
channeled_transport.h:36
noncopyable.h
Simple macro to hide class' copy constructor and assignment operator.
NON_COPYABLE
#define NON_COPYABLE(ClassName)
Definition
noncopyable.h:30
scheduled_executor.h
jami::tls::AbstractSIPTransport::TransportData::base
pjsip_transport base
Definition
abstract_sip_transport.h:39
src
jamidht
channeled_transport.h
Generated on Thu Jun 19 2025 15:50:37 for Ring Daemon by
1.9.8