blob: 9446574e53496f62873ce678fe4060099c79eb55 [file] [log] [blame]
James Kuszmaul4a42b182021-01-17 11:32:46 -08001#pragma once
2#include "../ice_server/server.h"
3#include <rawrtc/ice_gatherer.h>
4#include <rawrtcc/code.h>
5#include <re.h>
6#include <rew.h>
7
8/*
9 * Local candidate helper.
10 */
11struct rawrtc_candidate_helper {
12 struct le le;
13 struct rawrtc_ice_gatherer* gatherer;
14 struct ice_lcand* candidate;
15 struct udp_helper* udp_helper;
16 uint_fast8_t srflx_pending_count;
17 struct list stun_sessions;
18 uint_fast8_t relay_pending_count;
19};
20
21/*
22 * STUN keep-alive session.
23 */
24struct rawrtc_candidate_helper_stun_session {
25 struct le le;
26 struct rawrtc_candidate_helper* candidate_helper;
27 struct stun_keepalive* stun_keepalive;
28 struct rawrtc_ice_server_url* url;
29 bool pending;
30};
31
32enum rawrtc_code rawrtc_candidate_helper_create(
33 struct rawrtc_candidate_helper** const candidate_helperp, // de-referenced
34 struct rawrtc_ice_gatherer* gatherer,
35 struct ice_lcand* const candidate,
36 udp_helper_recv_h* const receive_handler,
37 void* const arg);
38
39enum rawrtc_code rawrtc_candidate_helper_set_receive_handler(
40 struct rawrtc_candidate_helper* const candidate_helper,
41 udp_helper_recv_h* const receive_handler,
42 void* const arg);
43
44enum rawrtc_code rawrtc_candidate_helper_find(
45 struct rawrtc_candidate_helper** const candidate_helperp,
46 struct list* const candidate_helpers,
47 struct ice_lcand* re_candidate);
48
49enum rawrtc_code rawrtc_candidate_helper_stun_session_create(
50 struct rawrtc_candidate_helper_stun_session** const sessionp, // de-referenced
51 struct rawrtc_ice_server_url* const url);
52
53enum rawrtc_code rawrtc_candidate_helper_stun_session_add(
54 struct rawrtc_candidate_helper_stun_session* const session,
55 struct rawrtc_candidate_helper* const candidate_helper,
56 struct stun_keepalive* const stun_keepalive);
57
58bool rawrtc_candidate_helper_remove_stun_sessions_handler(struct le* le, void* arg);