Ring Daemon
Loading...
Searching...
No Matches
uri.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 <cstdint>
20#include <string>
21#include <string_view>
22
23namespace jami {
24
25using namespace std::string_view_literals;
26
27static constexpr std::string_view DATA_TRANSFER_SCHEME = "data-transfer://"sv;
28
29class Uri
30{
31public:
32 enum class Scheme : uint8_t {
33 JAMI, // Start with "jami:" and 45 ASCII chars OR 40 ASCII chars
34 SIP, // Start with "sip:"
35 SWARM, // Start with "swarm:" and 40 ASCII chars
36 RENDEZVOUS, // Start with "rdv" and used for call in swarms
37 GIT, // Start with "git:"
38 DATA_TRANSFER, // Start with "data-transfer://"
39 SYNC, // Start with "sync:"
40 MESSAGE, // Start with "msg:"
41 AUTH, // Start with "auth:"
42 UNRECOGNIZED // Anything that doesn't fit in other categories
43 };
44
45 Uri(std::string_view uri);
46
47 const std::string& authority() const;
48 Scheme scheme() const;
49 std::string toString() const;
50 // TODO hostname, transport, handle sip:
51
52private:
53 constexpr std::string_view schemeToString() const;
54 Scheme scheme_;
55 std::string authority_;
56};
57} // namespace jami
Scheme
Definition uri.h:32
const std::string & authority() const
Definition uri.cpp:63
Scheme scheme() const
Definition uri.cpp:69
std::string toString() const
Definition uri.cpp:75
void emitSignal(Args... args)
Definition jami_signal.h:64
static constexpr std::string_view DATA_TRANSFER_SCHEME
Definition uri.h:27