2 * @file miranda-media.c
6 * Copyright (C) 2010-2016 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include "newpluginapi.h"
29 #include "m_protosvc.h"
30 #include "m_protoint.h"
32 #include "sipe-common.h"
33 #include "sipe-backend.h"
34 #include "sipe-core.h"
35 #include "miranda-private.h"
37 struct sipe_backend_media
{
41 struct sipe_backend_media
*
42 sipe_backend_media_new(struct sipe_core_public
*sipe_public
,
43 struct sipe_media_call
*call
,
44 const gchar
*participant
,
45 SipeMediaCallFlags flags
)
47 struct sipe_backend_media
*m
= g_new0(struct sipe_backend_media
,1);
53 sipe_backend_media_free(struct sipe_backend_media
*media
)
59 sipe_backend_media_set_cname(struct sipe_backend_media
*media
, gchar
*cname
)
64 struct sipe_backend_media_relays
*
65 sipe_backend_media_relays_convert(GSList
*media_relays
, gchar
*username
, gchar
*password
)
72 sipe_backend_media_relays_free(struct sipe_backend_media_relays
*media_relays
)
77 struct sipe_backend_media_stream
*
78 sipe_backend_media_add_stream(struct sipe_media_stream
*stream
,
80 SipeIceVersion ice_version
,
82 struct sipe_backend_media_relays
*media_relays
,
83 guint min_port
, guint max_port
)
90 sipe_backend_media_add_remote_candidates(struct sipe_media_call
*media
,
91 struct sipe_media_stream
*stream
,
97 gboolean
sipe_backend_media_is_initiator(struct sipe_media_call
*media
,
98 struct sipe_media_stream
*stream
)
104 gboolean
sipe_backend_media_accepted(struct sipe_backend_media
*media
)
111 sipe_backend_stream_initialized(struct sipe_media_call
*media
,
112 struct sipe_media_stream
*stream
)
119 sipe_backend_media_stream_get_active_local_candidates(struct sipe_media_stream
*stream
)
126 sipe_backend_media_stream_get_active_remote_candidates(struct sipe_media_stream
*stream
)
132 sipe_backend_media_set_encryption_keys(struct sipe_media_call
*media
,
133 struct sipe_media_stream
*stream
,
134 const guchar
*encryption_key
,
135 const guchar
*decryption_key
)
141 sipe_backend_stream_hold(struct sipe_media_call
*media
,
142 struct sipe_media_stream
*stream
,
149 sipe_backend_stream_unhold(struct sipe_media_call
*media
,
150 struct sipe_media_stream
*stream
,
157 sipe_backend_stream_is_held(struct sipe_media_stream
*stream
)
164 sipe_backend_media_stream_end(struct sipe_media_call
*media
,
165 struct sipe_media_stream
*stream
)
171 sipe_backend_media_stream_free(struct sipe_backend_media_stream
*stream
)
176 struct sipe_backend_codec
*
177 sipe_backend_codec_new(int id
, const char *name
, SipeMediaType type
,
178 guint clock_rate
, guint channels
)
185 sipe_backend_codec_free(struct sipe_backend_codec
*codec
)
191 sipe_backend_codec_get_id(struct sipe_backend_codec
*codec
)
198 sipe_backend_codec_get_name(struct sipe_backend_codec
*codec
)
205 sipe_backend_codec_get_clock_rate(struct sipe_backend_codec
*codec
)
212 sipe_backend_codec_add_optional_parameter(struct sipe_backend_codec
*codec
,
213 const gchar
*name
, const gchar
*value
)
219 sipe_backend_codec_get_optional_parameters(struct sipe_backend_codec
*codec
)
226 sipe_backend_set_remote_codecs(struct sipe_media_call
*media
,
227 struct sipe_media_stream
*stream
,
235 sipe_backend_get_local_codecs(struct sipe_media_call
*media
,
236 struct sipe_media_stream
*stream
)
242 struct sipe_backend_candidate
*
243 sipe_backend_candidate_new(const gchar
*foundation
,
244 SipeComponentType component
,
245 SipeCandidateType type
, SipeNetworkProtocol proto
,
246 const gchar
*ip
, guint port
,
247 const gchar
*username
,
248 const gchar
*password
)
255 sipe_backend_candidate_free(struct sipe_backend_candidate
*candidate
)
261 sipe_backend_candidate_get_username(struct sipe_backend_candidate
*candidate
)
268 sipe_backend_candidate_get_password(struct sipe_backend_candidate
*candidate
)
275 sipe_backend_candidate_get_foundation(struct sipe_backend_candidate
*candidate
)
282 sipe_backend_candidate_get_ip(struct sipe_backend_candidate
*candidate
)
289 sipe_backend_candidate_get_port(struct sipe_backend_candidate
*candidate
)
296 sipe_backend_candidate_get_base_ip(struct sipe_backend_candidate
*candidate
)
303 sipe_backend_candidate_get_base_port(struct sipe_backend_candidate
*candidate
)
310 sipe_backend_candidate_get_priority(struct sipe_backend_candidate
*candidate
)
317 sipe_backend_candidate_set_priority(struct sipe_backend_candidate
*candidate
, guint32 priority
)
323 sipe_backend_candidate_get_component_type(struct sipe_backend_candidate
*candidate
)
326 return SIPE_COMPONENT_NONE
;
330 sipe_backend_candidate_get_type(struct sipe_backend_candidate
*candidate
)
333 return SIPE_CANDIDATE_TYPE_ANY
;
337 sipe_backend_candidate_get_protocol(struct sipe_backend_candidate
*candidate
)
340 return SIPE_NETWORK_PROTOCOL_TCP_ACTIVE
;
344 sipe_backend_get_local_candidates(struct sipe_media_call
*media
,
345 struct sipe_media_stream
*stream
)
352 sipe_backend_media_accept(struct sipe_backend_media
*media
, gboolean local
)
358 sipe_backend_media_hangup(struct sipe_backend_media
*media
, gboolean local
)
364 sipe_backend_media_reject(struct sipe_backend_media
*media
, gboolean local
)
370 sipe_backend_media_get_encryption_policy(struct sipe_core_public
*sipe_public
)
372 return SIPE_ENCRYPTION_POLICY_REJECTED
;
376 sipe_backend_media_stream_read(struct sipe_media_stream
*stream
,
377 guint8
*buffer
, gsize len
)
383 sipe_backend_media_stream_write(struct sipe_media_stream
*stream
,
384 guint8
*buffer
, gsize len
)