blob: 56d42111549967014bce30c7b166a6056ae6423a [file] [log] [blame]
James Kuszmaul4a42b182021-01-17 11:32:46 -08001#pragma once
2#include "common.h"
3#include <rawrtc.h>
4#include <rawrtcc.h>
5#include <rawrtcdc.h>
6#include <re.h>
7
8/*
9 * Print the ICE gatherer's state.
10 */
11void default_ice_gatherer_state_change_handler(
12 enum rawrtc_ice_gatherer_state const state, // read-only
13 void* const arg);
14
15/*
16 * Print the ICE gatherer's error event.
17 */
18void default_ice_gatherer_error_handler(
19 struct rawrtc_ice_candidate* const host_candidate, // read-only, nullable
20 char const* const url, // read-only
21 uint16_t const error_code, // read-only
22 char const* const error_text, // read-only
23 void* const arg // will be casted to `struct client*`
24);
25
26/*
27 * Print the newly gatherered local candidate.
28 * Will print local parameters on stdout in case the client is not
29 * used in loopback mode.
30 */
31void default_ice_gatherer_local_candidate_handler(
32 struct rawrtc_ice_candidate* const candidate,
33 char const* const url, // read-only
34 void* const arg // will be casted to `struct client*`
35);
36
37/*
38 * Print the ICE transport's state.
39 */
40void default_ice_transport_state_change_handler(
41 enum rawrtc_ice_transport_state const state,
42 void* const arg // will be casted to `struct client*`
43);
44
45/*
46 * Print the ICE candidate pair change event.
47 */
48void default_ice_transport_candidate_pair_change_handler(
49 struct rawrtc_ice_candidate* const local, // read-only
50 struct rawrtc_ice_candidate* const remote, // read-only
51 void* const arg // will be casted to `struct client*`
52);
53
54/*
55 * Print the DTLS transport's state.
56 */
57void default_dtls_transport_state_change_handler(
58 enum rawrtc_dtls_transport_state const state, // read-only
59 void* const arg // will be casted to `struct client*`
60);
61
62/*
63 * Print the DTLS transport's error event.
64 */
65void default_dtls_transport_error_handler(
66 // TODO: error.message (probably from OpenSSL)
67 void* const arg // will be casted to `struct client*`
68);
69
70#if RAWRTC_HAVE_SCTP_REDIRECT_TRANSPORT
71/*
72 * Print the SCTP redirect transport's state.
73 */
74void default_sctp_redirect_transport_state_change_handler(
75 enum rawrtc_sctp_redirect_transport_state const state,
76 void* const arg // will be casted to `struct client*`
77);
78#endif
79
80/*
81 * Print the SCTP transport's state.
82 */
83void default_sctp_transport_state_change_handler(
84 enum rawrtc_sctp_transport_state const state,
85 void* const arg // will be casted to `struct client*`
86);
87
88/*
89 * Print the newly created data channel's parameter.
90 */
91void default_data_channel_handler(
92 struct rawrtc_data_channel* const data_channel, // read-only, MUST be referenced when used
93 void* const arg // will be casted to `struct data_channel_helper*`
94);
95
96/*
97 * Print the data channel open event.
98 */
99void default_data_channel_open_handler(
100 void* const arg // will be casted to `struct data_channel_helper*`
101);
102
103/*
104 * Print the data channel buffered amount low event.
105 */
106void default_data_channel_buffered_amount_low_handler(
107 void* const arg // will be casted to `struct data_channel_helper*`
108);
109
110/*
111 * Print the data channel error event.
112 */
113void default_data_channel_error_handler(
114 void* const arg // will be casted to `struct data_channel_helper*`
115);
116
117/*
118 * Print the data channel close event.
119 */
120void default_data_channel_close_handler(
121 void* const arg // will be casted to `struct data_channel_helper*`
122);
123
124/*
125 * Print the data channel's received message's size.
126 */
127void default_data_channel_message_handler(
128 struct mbuf* const buffer,
129 enum rawrtc_data_channel_message_flag const flags,
130 void* const arg // will be casted to `struct data_channel_helper*`
131);
132
133/*
134 * Print negotiation needed (duh!)
135 */
136void default_negotiation_needed_handler(void* const arg);
137
138/*
139 * Print the peer connection's state.
140 */
141void default_peer_connection_state_change_handler(
142 enum rawrtc_peer_connection_state const state, // read-only
143 void* const arg // will be casted to `struct client*`
144);
145
146/*
147 * Print the newly gathered local candidate (peer connection variant).
148 */
149void default_peer_connection_local_candidate_handler(
150 struct rawrtc_peer_connection_ice_candidate* const candidate,
151 char const* const url, // read-only
152 void* const arg);
153
154/*
155 * Print the peer connections local candidate error event.
156 */
157void default_peer_connection_local_candidate_error_handler(
158 struct rawrtc_peer_connection_ice_candidate* const candidate, // read-only, nullable
159 char const* const url, // read-only
160 uint16_t const error_code, // read-only
161 char const* const error_text, // read-only
162 void* const arg // will be casted to `struct client*`
163);
164
165/*
166 * Print the signaling state.
167 */
168void default_signaling_state_change_handler(
169 enum rawrtc_signaling_state const state, // read-only
170 void* const arg);
171
172/*
173 * Stop the main loop.
174 */
175void default_signal_handler(int sig);
176
177/*
178 * FD-listener that stops the main loop in case the input buffer is
179 * empty.
180 */
181void stop_on_return_handler(int flags, void* arg);