1 /* GStreamer
2  * Copyright (C) 2017 Matthew Waters <matthew@centricular.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef __WEBRTC_SDP_H__
21 #define __WEBRTC_SDP_H__
22 
23 #include <gst/gst.h>
24 #include <gst/webrtc/webrtc.h>
25 #include "fwd.h"
26 
27 G_BEGIN_DECLS
28 
29 typedef enum
30 {
31   SDP_NONE,
32   SDP_LOCAL,
33   SDP_REMOTE,
34 } SDPSource;
35 
36 G_GNUC_INTERNAL
37 const gchar *                       _sdp_source_to_string                   (SDPSource source);
38 
39 
40 G_GNUC_INTERNAL
41 gboolean                            validate_sdp                            (GstWebRTCSignalingState state,
42                                                                              SDPSource source,
43                                                                              GstWebRTCSessionDescription * sdp,
44                                                                              GError ** error);
45 
46 G_GNUC_INTERNAL
47 GstWebRTCRTPTransceiverDirection    _get_direction_from_media               (const GstSDPMedia * media);
48 G_GNUC_INTERNAL
49 GstWebRTCRTPTransceiverDirection    _intersect_answer_directions            (GstWebRTCRTPTransceiverDirection offer,
50                                                                              GstWebRTCRTPTransceiverDirection answer);
51 G_GNUC_INTERNAL
52 void                                _media_replace_direction                (GstSDPMedia * media,
53                                                                              GstWebRTCRTPTransceiverDirection direction);
54 G_GNUC_INTERNAL
55 GstWebRTCRTPTransceiverDirection    _get_final_direction                     (GstWebRTCRTPTransceiverDirection local_dir,
56                                                                              GstWebRTCRTPTransceiverDirection remote_dir);
57 
58 G_GNUC_INTERNAL
59 GstWebRTCDTLSSetup                  _get_dtls_setup_from_media              (const GstSDPMedia * media);
60 G_GNUC_INTERNAL
61 GstWebRTCDTLSSetup                  _intersect_dtls_setup                   (GstWebRTCDTLSSetup offer);
62 G_GNUC_INTERNAL
63 void                                _media_replace_setup                    (GstSDPMedia * media,
64                                                                              GstWebRTCDTLSSetup setup);
65 G_GNUC_INTERNAL
66 GstWebRTCDTLSSetup                  _get_final_setup                        (GstWebRTCDTLSSetup local_setup,
67                                                                              GstWebRTCDTLSSetup remote_setup);
68 G_GNUC_INTERNAL
69 gchar *                             _generate_fingerprint_from_certificate  (gchar * certificate,
70                                                                              GChecksumType checksum_type);
71 G_GNUC_INTERNAL
72 void                                _generate_ice_credentials               (gchar ** ufrag,
73                                                                              gchar ** password);
74 
75 G_GNUC_INTERNAL
76 gboolean                            _media_has_attribute_key                (const GstSDPMedia * media,
77                                                                              const gchar * key);
78 
79 G_GNUC_INTERNAL
80 int                                 _get_sctp_port_from_media               (const GstSDPMedia * media);
81 G_GNUC_INTERNAL
82 guint64                             _get_sctp_max_message_size_from_media   (const GstSDPMedia * media);
83 
84 G_GNUC_INTERNAL
85 void                                _get_ice_credentials_from_sdp_media     (const GstSDPMessage * sdp,
86                                                                              guint media_idx,
87                                                                              gchar ** ufrag,
88                                                                              gchar ** pwd);
89 G_GNUC_INTERNAL
90 gboolean                            _message_media_is_datachannel           (const GstSDPMessage * msg,
91                                                                              guint media_id);
92 
93 G_GNUC_INTERNAL
94 gboolean                            _get_bundle_index                       (GstSDPMessage * sdp,
95                                                                              GStrv bundled,
96                                                                              guint * idx);
97 G_GNUC_INTERNAL
98 gboolean                            _parse_bundle                           (GstSDPMessage * sdp,
99                                                                              GStrv * bundled);
100 
101 #endif /* __WEBRTC_UTILS_H__ */
102