blob: 8befa52ccb98b4b6fbad5e7ba1190bfad3c2d5d2 [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 * SDP type.
7 */
8enum rawrtc_sdp_type {
9 RAWRTC_SDP_TYPE_OFFER,
10 RAWRTC_SDP_TYPE_PROVISIONAL_ANSWER,
11 RAWRTC_SDP_TYPE_ANSWER,
12 RAWRTC_SDP_TYPE_ROLLBACK,
13};
14
15/*
16 * Peer connection description.
17 */
18struct rawrtc_peer_connection_description;
19
20/*
21 * Create a description by parsing it from SDP.
22 * `*descriptionp` must be unreferenced.
23 */
24enum rawrtc_code rawrtc_peer_connection_description_create(
25 struct rawrtc_peer_connection_description** const descriptionp, // de-referenced
26 enum rawrtc_sdp_type const type,
27 char const* const sdp);
28
29/*
30 * Get the SDP type of the description.
31 */
32enum rawrtc_code rawrtc_peer_connection_description_get_sdp_type(
33 enum rawrtc_sdp_type* const typep, // de-referenced
34 struct rawrtc_peer_connection_description* const description);
35
36/*
37 * Get the SDP of the description.
38 * `*sdpp` will be set to a copy of the SDP that must be unreferenced.
39 */
40enum rawrtc_code rawrtc_peer_connection_description_get_sdp(
41 char** const sdpp, // de-referenced
42 struct rawrtc_peer_connection_description* const description);
43
44/*
45 * Translate an SDP type to str.
46 */
47char const* rawrtc_sdp_type_to_str(enum rawrtc_sdp_type const type);
48
49/*
50 * Translate a str to an SDP type.
51 */
52enum rawrtc_code rawrtc_str_to_sdp_type(
53 enum rawrtc_sdp_type* const typep, // de-referenced
54 char const* const str);