blob: d850eb58a919df04418e16b7a1d3d1a7c6614544 [file] [log] [blame]
James Kuszmaul4a42b182021-01-17 11:32:46 -08001#pragma once
2#include <rawrtcc/code.h>
3#include <re.h>
4
5/*
6 * ICE gather policy.
7 */
8enum rawrtc_ice_gather_policy {
9 RAWRTC_ICE_GATHER_POLICY_ALL,
10 RAWRTC_ICE_GATHER_POLICY_NOHOST,
11 RAWRTC_ICE_GATHER_POLICY_RELAY,
12};
13
14/*
15 * ICE credential type
16 */
17enum rawrtc_ice_credential_type {
18 RAWRTC_ICE_CREDENTIAL_TYPE_NONE,
19 RAWRTC_ICE_CREDENTIAL_TYPE_PASSWORD,
20 RAWRTC_ICE_CREDENTIAL_TYPE_TOKEN,
21};
22
23/*
24 * ICE gather options.
25 */
26struct rawrtc_ice_gather_options;
27
28/*
29 * Create a new ICE gather options instance.
30 * `*optionsp` must be unreferenced.
31 */
32enum rawrtc_code rawrtc_ice_gather_options_create(
33 struct rawrtc_ice_gather_options** const optionsp, // de-referenced
34 enum rawrtc_ice_gather_policy const gather_policy);
35
36/*
37 * Add an ICE server to the gather options.
38 */
39enum rawrtc_code rawrtc_ice_gather_options_add_server(
40 struct rawrtc_ice_gather_options* const options,
41 char* const* const urls, // copied
42 size_t const n_urls,
43 char* const username, // nullable, copied
44 char* const credential, // nullable, copied
45 enum rawrtc_ice_credential_type const credential_type);
46
47/*
48 * Translate an ICE gather policy to str.
49 */
50char const* rawrtc_ice_gather_policy_to_str(enum rawrtc_ice_gather_policy const policy);
51
52/*
53 * Translate a str to an ICE gather policy (case-insensitive).
54 */
55enum rawrtc_code rawrtc_str_to_ice_gather_policy(
56 enum rawrtc_ice_gather_policy* const policyp, // de-referenced
57 char const* const str);