blob: c26b83eefd5dfba83604a2887ce7b378d8475db6 [file] [log] [blame]
Adrien BĂ©raud612b55b2023-05-29 10:42:04 -04001#pragma once
2
3#include <functional>
4#include <vector>
5#include <string>
6
7#include "ip_utils.h"
8
9namespace jami {
10
11class IceTransportFactory;
12using IceTransportCompleteCb = std::function<void(bool)>;
13
14struct StunServerInfo
15{
16 inline StunServerInfo& setUri(const std::string& args) {
17 uri = args;
18 return *this;
19 }
20
21 std::string uri; // server URI, mandatory
22};
23
24struct TurnServerInfo
25{
26 inline TurnServerInfo& setUri(const std::string& args) {
27 uri = args;
28 return *this;
29 }
30 inline TurnServerInfo& setUsername(const std::string& args) {
31 username = args;
32 return *this;
33 }
34 inline TurnServerInfo& setPassword(const std::string& args) {
35 password = args;
36 return *this;
37 }
38 inline TurnServerInfo& setRealm(const std::string& args) {
39 realm = args;
40 return *this;
41 }
42
43 std::string uri; // server URI, mandatory
44 std::string username; // credentials username (optional, empty if not used)
45 std::string password; // credentials password (optional, empty if not used)
46 std::string realm; // credentials realm (optional, empty if not used)
47};
48
49struct IceTransportOptions
50{
51 IceTransportFactory* factory {nullptr};
52 bool master {true};
53 unsigned streamsCount {1};
54 unsigned compCountPerStream {1};
55 bool upnpEnable {false};
56 IceTransportCompleteCb onInitDone {};
57 IceTransportCompleteCb onNegoDone {};
58 std::vector<StunServerInfo> stunServers;
59 std::vector<TurnServerInfo> turnServers;
60 bool tcpEnable {false};
61 // Addresses used by the account owning the transport instance.
62 IpAddr accountLocalAddr {};
63 IpAddr accountPublicAddr {};
64};
65
66}