Ring Daemon 16.0.0
Loading...
Searching...
No Matches
auth_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
20#include "jamidht/jamiaccount.h"
21#include <dhtnet/connectionmanager.h>
22// #include <opendht/crypto.h>
23
24namespace jami {
25
30{
31public:
32 AuthChannelHandler(const std::shared_ptr<JamiAccount>& acc, dhtnet::ConnectionManager& cm);
34
41 void connect(const DeviceId& deviceId,
42 const std::string& name,
43 ConnectCb&& cb,
44 const std::string& connectionType = "",
45 bool forceNewConnection = false) override;
46 void connect(const dht::InfoHash& infoHash,
47 const std::string&,
48 ConnectCallbackLegacy&& cb) override;
49
56 bool onRequest(const std::shared_ptr<dht::crypto::Certificate>& peer,
57 const std::string& name) override;
58
65 void onReady(const std::shared_ptr<dht::crypto::Certificate>& peer,
66 const std::string& name,
67 std::shared_ptr<dhtnet::ChannelSocket> channel) override;
68
69private:
70 std::weak_ptr<JamiAccount> account_;
71 dhtnet::ConnectionManager& connectionManager_;
72};
73
74} // namespace jami
Manages channels for syncing informations.
void connect(const DeviceId &deviceId, const std::string &name, ConnectCb &&cb, const std::string &connectionType="", bool forceNewConnection=false) override
Ask for a new sync channel.
bool onRequest(const std::shared_ptr< dht::crypto::Certificate > &peer, const std::string &name) override
Determine if we accept or not the sync request.
void onReady(const std::shared_ptr< dht::crypto::Certificate > &peer, const std::string &name, std::shared_ptr< dhtnet::ChannelSocket > channel) override
Launch sync process.
A Channel handler is used to make the link between JamiAccount and ConnectionManager Its role is to m...
std::function< void(std::shared_ptr< dhtnet::ChannelSocket >, const DeviceId &)> ConnectCb
dht::PkId DeviceId
void emitSignal(Args... args)
Definition ring_signal.h:64
std::function< void(std::shared_ptr< dhtnet::ChannelSocket >, const dht::InfoHash &)> ConnectCallbackLegacy