Ring Daemon 16.0.0
Loading...
Searching...
No Matches
swarm_channel_handler.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
21
22#include <dhtnet/multiplexed_socket.h>
23#include "logger.h"
24
25namespace jami {
26
27using NodeId = dht::h256;
28
29class JamiAccount;
30
35{
36public:
37 SwarmChannelHandler(const std::shared_ptr<JamiAccount>& acc, dhtnet::ConnectionManager& cm);
39
40#ifdef LIBJAMI_TEST
41 std::atomic_bool disableSwarmManager {false};
42#endif
43
52 void connect(const NodeId& nodeId,
53 const std::string& name,
54 ConnectCb&& cb,
55 const std::string& connectionType = "",
56 bool forceNewConnection = false) override;
57
64 bool onRequest(const std::shared_ptr<dht::crypto::Certificate>& peer,
65 const std::string& name) override;
66
70 void onReady(const std::shared_ptr<dht::crypto::Certificate>& peer,
71 const std::string& name,
72 std::shared_ptr<dhtnet::ChannelSocket> channel) override;
73
74private:
75 std::weak_ptr<JamiAccount> account_;
76 dhtnet::ConnectionManager& connectionManager_;
77};
78
79} // namespace jami
A Channel handler is used to make the link between JamiAccount and ConnectionManager Its role is to m...
Ring Account is build on top of SIPAccountBase and uses DHT to handle call connectivity.
Definition jamiaccount.h:96
Manages Conversation's channels.
void onReady(const std::shared_ptr< dht::crypto::Certificate > &peer, const std::string &name, std::shared_ptr< dhtnet::ChannelSocket > channel) override
TODO, this needs to extract gitservers from JamiAccount.
void connect(const NodeId &nodeId, const std::string &name, ConnectCb &&cb, const std::string &connectionType="", bool forceNewConnection=false) override
Ask for a new git channel.
bool onRequest(const std::shared_ptr< dht::crypto::Certificate > &peer, const std::string &name) override
Determine if we accept or not the git request.
std::function< void(std::shared_ptr< dhtnet::ChannelSocket >, const DeviceId &)> ConnectCb
dht::h256 NodeId
void emitSignal(Args... args)
Definition ring_signal.h:64