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